3 ms·
FWIW, I find that form quite useful for defining short aliases, e.g. int *const current_foo = &items[i].bar.foo; before some complicated manipulations on
by JoachimSchipper 7y ago
FWIW, I find that form quite useful for defining short aliases, e.g.
int *const current_foo = &items[i].bar.foo;
before some complicated manipulations on current_foo.
(A decent (SSA-)optimizing compiler will produce identical code with and without the declaration.)
- loeg 7y agoYeah, this only works if you initialize at the same time as declaration. And as you say, without const, the same code is generated. All it prevents is accidental reuse of current_foo, which may have some value.