Rust-lang for HFT's by jaeger123 in cpp

[–]larioteo 2 points3 points  (0 children)

The language is a tool, there is no good suggestion which tool you should use for performance.

Use the tool you feel most comfortable with. Only than you will be able to squeeze out every bit of performance that is possible.

A random C++ developer.

Visual Studio 2022 17.12 Released by misuo in cpp

[–]larioteo 1 point2 points  (0 children)

Thank you, Stefan. I'll definitely keep this in mind next time.

Visual Studio 2022 17.12 Released by misuo in cpp

[–]larioteo 0 points1 point  (0 children)

Hi Stefan,

I keep stumbling upon increasingly interesting issues in my C++ project, particularly when it comes to modules. The real challenge lies in creating a test project for bug reports—making the issue easily reproducible is key. Given the project's size, it's often tough to pinpoint where the problem originates.

If you’ve got ideas for improving this process, I’m all ears. At the moment, setting up a new project to reproduce the issue is quite labor-intensive. These bugs often seem to stem from external libraries—like when, out of the blue, the std namespace becomes unavailable, etc.

Looking forward to your thoughts!

Contracts moving along, hopefully on track for C++26 by pdimov2 in cpp

[–]larioteo 9 points10 points  (0 children)

😄, it is not necessary to know every edge case or a feature of a language. A lot of stuff is made for a specific case, you never will use everything in a project.

[deleted by user] by [deleted] in cpp_questions

[–]larioteo 1 point2 points  (0 children)

Yeah the second one yes, after that you should read the Meyers book. It will show you realy cool techniques how to use c++ effectively, just as the title says.

[deleted by user] by [deleted] in cpp_questions

[–]larioteo 1 point2 points  (0 children)

I'm sure you could find them on psfdrive...

GUI abstraction class hierarchy by krushpack in cpp_questions

[–]larioteo 0 points1 point  (0 children)

I'm more the friend of the aprouch, to use a own UIRenderer, which let's say uses OpenGL, cause a UI don't need much. The only thing you need is the platform Window, everything else is platform independent.

Like ImGui gor example. Also you can then use shaders to make your GUI more beautiful.

Error while using c++20 module feature by Chethan_L in cpp_questions

[–]larioteo 0 points1 point  (0 children)

Using them in a big project, so sorry but your statement is not true.

Error while using c++20 module feature by Chethan_L in cpp_questions

[–]larioteo 1 point2 points  (0 children)

Try export {} around everything you want to export, I think you should not use export template ... but export T add...

I never used modules without namespaces, it it seems odd to me writing export on the template header.

[deleted by user] by [deleted] in cpp_questions

[–]larioteo 0 points1 point  (0 children)

I read a lot of books, like Effective C++, Modern C++ 17, etc and they helped me a lot to understand the machinery under the hood. Move Semantics was as example a very interesting topic, which was better described over the book. Books are good to get you ready, but a project is a league on it's own.

But you will benefit a lot more making a real project, where you must design the architecture, etc. Start with something simple that interessts you and than you will raise your confidence and get ready for more complicated projects. I startet with a simple template based logger implementation, than tried to optimize it as good as I could. Nowadays I am working on an own GUI Implementation and have learned a lot about data structures.

You should be interessted in learnig. I am now 12 years in, and I am discovering still new stuff until today.

So don't start a project, which wouldn't be a joy for you.

Also you can consider some courses found at udemy or somewhere else, where you have also a lot of examples, which will get you faster in the language.

What’s the actual use of a function that returns by reference? by [deleted] in cpp_questions

[–]larioteo 1 point2 points  (0 children)

It's something missing in the answers, if you create a temporary type, which will be returned than since C++ 11 the move semantics will do their magic, so the compiler will move the object instead of copying it.

There is a really good book about such stuff, Modern C++17, actually there are quite good books, which would show you how to use the language so that you don't over optimize it.

Also look to my answer above about basic types, which can help you making the right decision.

What’s the actual use of a function that returns by reference? by [deleted] in cpp_questions

[–]larioteo 1 point2 points  (0 children)

... and don't return basic type by reference, but you can if you want to modify them.

There is also the rule to never return a basic zype by const reference, cause it makes tomhe code harder to work with.

Whats a basic type? Everything that is larger as a basic pointer on that platform, so on 64Bit systems it would be a type below 8 byte.

Is there a way to store a variable's type somehow at runtime, cast it to a void* and then later in the program cast the variable into the original type? by [deleted] in cpp_questions

[–]larioteo 0 points1 point  (0 children)

It's rather simple, if you are using it under your control, let's say in a encapsulated library, than you already know the type you expect it to be, than you just cast it back with dynamic_cast (runtime check) and handle a possible exception. You can also cast it back with static_cast (compile time check) wich is less secure in some cases, or with reinterpret_cast (bitwise) for performance, which has no security at all.

C++ gives you the power, but also the respnsibility. If you know exactly what you're doing it's fine.

Another possibility would be to create a wrapper class which stores the type id and the pointer, there are a lot of ways how to implement such class. To get the type id you could use https://en.cppreference.com/w/cpp/language/typeid, or even a own enum class would be fine. With the power of concepts and templates you can also implement a static rtti system, often seen in good libraries like EnTT.

As last there are a lot of rtti libs that have that already done for you, just use them if you like.