Hacker News new | ask | show | jobs
by jforberg 2498 days ago
It 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.

1 comments

> 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