| ▲ | 112233 2 hours ago |
| "This article was originally published in Polish in issue 4/2013" — a lot of excellent advice. Sad to see C++ have moved in last decade in a direction that makes writing efficient, simple low level code harder and harder :( |
|
| ▲ | jandrewrogers 25 minutes ago | parent | next [-] |
| Writing clear, concise, and efficient code in C++ has never been simpler or easier. The improvements in C++ over the last 15 years have been qualitative. So many complex, esoteric, and difficult to maintain incantations that used to be required for efficient code generation are no longer necessary. |
|
| ▲ | jll29 an hour ago | parent | prev | next [-] |
| I think it has become EASIER: for instance, since C++23 Rust-like move semantics can be used, which provides the compiler with extra information that can be leveraged for the generation of better code. Or take constexpr - it permits to move computations to compile time that are complex and in older versions either had to be done at runtime, or an ugly workaround had to be used (e.g. assigning a mysterious literal pre-computed in another run or by hand). |
| |
| ▲ | creata an hour ago | parent [-] | | > C++23 Rust-like move semantics can be used What C++23 feature allows that? | | |
|
|
| ▲ | fooblaster 2 hours ago | parent | prev [-] |
| How? you can write exactly the same low level code today. |
| |
| ▲ | beached_whale 2 hours ago | parent | next [-] | | My thought too. There are so many things that are expressible in C++ now that could not be without writing much more code or using per-compilation tools back then. The ability to run code at compile time that is not run at runtime is huge, #embed lets us make other tools output available without linker scripts or compiler specific tools that. Also, most of the code from the past still works(from 10 years ago definitely works) | |
| ▲ | AlotOfReading an hour ago | parent | prev [-] | | Shot in the dark, but maybe the OP is referring to the fact that these code conventions are explicitly discouraged by the C++ core guidelines. The SoA example falls afoul of the rule requiring T* to be used only for singular object pointers, for example. | | |
| ▲ | cjbgkagh an hour ago | parent [-] | | Not a regular C++ programmer but wouldn’t you use std::span here instead? Sure it’ll carry a few redundant lengths but it makes using functions that take spans easier. When I do write C++ it’s usually for speed so I’m often working at the intrinsics level, though AI has gotten good enough at it that I now generally delegate this work to an agent. | | |
|
|