3 ms·
Shouldn't the test instead be: const int * const <variable name> Haven't profiled it but would make more sense to have the pointer also be const instead of hav
by kmadento 7y ago
Shouldn't the test instead be:
const int * const <variable name>
Haven't profiled it but would make more sense to have the pointer also be const instead of having a non const pointer as input?
- jforberg 7y agoIt rarely makes sense. Pointer to const is a contact between caller and callee. A signature like char <star>strdup(const char <star>) says "I take a pointer to memory that I promise not to modify, and you get a pointer to memory that you may modify". Const pointer is a statement about the internal variables of a function definition, usually not of any interest outside the function itself and therefore rarely used.
- MauranKilom 7y ago> Const pointer is a statement about the internal variables of a function definition, usually not of any interest outside the function itself and therefore rarely used. ...and in fact not even part of the name mangling (for the exact reason you mentioned): https://godbolt.org/z/1pjecq https://godbolt.org/z/1pjecq