C
Charlie Gordon
James Kuyper said:pete wrote:
...int matrix_check(int (*m)[10]) { ... }
I like the pointer notation for the parameter,
because that makes it more obvious what the parameter really is.
If I declared it the way you suggest, the compiler I use most frequently
would insist on reminding me that I should declare 'm' to be const. It
issues no such reminder when I use "int m[][10]", even though that's
functionally equivalent to your declaration. I can't turn off that
reminder without turning off other 'const'-related reminders that I
actually find useful.
It's annoying how stupid things like that can affect your programming
style.
Interesting!
Does it suggest const because it determines the array is not modified in the
body of the function?
It is really unfortunate that a warning like that, while useful in some
circumstances, cannot be controlled on a function basis. It can be a pain
when the function signature is imposed by some external constraint such as
consistency with other functions sharing a common interface.
What compiler are you using?