Paragraph 6.7.3.8 of the C99 spec states
If the specification of an array type includes any type qualifiers, the element type is so-qualified, not the array ty
The situation is awkward with pointers (ie, arrays), but here's my recollection of the details:
const double *ap
is a pointer to a constant double;
double *const ap
is a constant pointer to a double;
const double *const ap
is a constant pointer to a constant double;
So I believe it is possible to do what you're asking, although I've not tried this in years -- the gcc
option you're using wasn't available the last time I did this!
EDIT: This answer is not correct for the question - I'm leaving it to preserve the comments below, which clarify the problem for mere mortals (or rusty C developers...)