2 ms·
The stack overflow link is about a different mater. And it is compelling. I managed lower memory usage and improve performance very significantly using this tec
by GuB-42 8y ago
The stack overflow link is about a different mater. And it is compelling. I managed lower memory usage and improve performance very significantly using this technique.
That kind of control over memory is what C is very good at, and it is, I think, the main reason why C tops almost every benchmark.
Note that modern C++ offers everything C has to offer plus even better, more advanced tools. As a result, it should be even faster. However, "proper" C++ is a bit more hands off when it comes to memory management, with things like generic containers, smart pointers, ... It tends to result in a slightly worse performance.
As for the "foo[1]" as it is described in the article, it is just syntax. Some people may find it more readable than &foo, it doesn't matter. Kind of like &table[1] vs table+1. Use the form you prefer, or even 1[table] if you are making an IOCCC entry.