Since C passes arguments by value, there is no difference between
void foo(int bar);
and
void foo(const int bar);
regarding the call code.
Thus, const-qualifying for a parameter without a pointer probably makes an internal implementation detail of an internal public API.
Another solution would be to declare a function without const in the header and only add it to the definition (as Oli Charlworth also suggests in the comments), i.e.
// in header file extern void foo(int bar); // in source file void foo(const int bar) { // ... }
which, to my knowledge, is legal due to the last sentence of C99 6.7.5.3 ยง15.
source share