Jerry Feldman wrote:
int g( int (*const)(int x) ); int g( int (*f)(int const) );
Is this correct behaviour?
In both cases, you are prototyping a function that takes a function pointer as an argument. In the first case, I believe that you are making the function pointer const, and in the second case, you are making the argument to the function pointed to const.
Not having tested it with GCC, but I really think this is a trivial issue (at least with the int argument). I also think that there is room for the compiler to misinterpret.
However, if you want to discuss this further we can do it in person. The BLU is having a BarBQ today (http://www.blu.org). Why not grab the closest Jet and fly up to Boston :-). The weather is great today.
I've managed to check this againt the 1996 draft standard: a const qualifier doesn't affect the function type, only the behaviour of the parameter within the body of the function. So gcc is behaving correctly. You are of course correct on all three points: this is a trivial issue, there is room for a compiler to misinterpret and I really should get out more often ;-). Sadly Boston is just a little too far for a day trip. -- JDL Non enim propter gloriam, diuicias aut honores pugnamus set propter libertatem solummodo quam Nemo bonus nisi simul cum vita amittit.