On Sat, 07 Feb 2004 05:32:42 GMT, Jack Klein <ja*******@spamcop.net>
wrote:
Not sure I see how it is a syntax error; 6.7/1 doesn't seem to impose
any ordering requirements on all the different flavors of declaration
specifiers, so does it matter whether CV qualifiers come before or
after struct-or-union-specifiers?
Comeau doesn't even raise a warning on it.
OK, you caught me. Looking at the grammar, I think it is probably
quite legal.
I watched the original post sit there for hours, and wanted to reply
that the two statements were equivalent, but I'd gotten just a bit
gun-shy after several recent gaffes. Finally, seeing no one had
responded, I looked it up in the standard to my own satisfaction,
wrote it up, and was about to send it off when your post showed up. So
then I went back to the drawing board and studied it some more....
That I saw this straight off I probably have Dan Saks to thank for.
He wrote a 5-day Advanced C course last year in direct response to a
call I put out for one; in that course, he has students write their
own C declaration parsers, building them up bit-by-bit until they
handle stuff that gets pretty darned hairy. This is somewhat congruent
to the series of articles he wrote for CUJ in an attempt to de-mystify
C++ declaration syntax.
Let's just say that I never thought the day would come that I'd
actually be able to remember the difference between
declaration-specifiers and declarators, but after teaching that
course, even a year later, I still do remember. Amazing... ;-)
-leor