Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!brutus.cs.uiuc.edu!jarthur!uci-ics!gateway From: rfg@paris.ics.uci.edu (Ron Guilmette) Newsgroups: comp.std.c Subject: Is `char const *foo;' legal? Message-ID: <25ABBF93.9618@paris.ics.uci.edu> Date: 10 Jan 90 23:04:51 GMT Organization: UC Irvine Department of ICS Lines: 38 I have recently learned that the GNU C compiler accepts the following declaration without complaint: char const *foo; It treats such a declaration as being identical to: const char *foo; Now I have looked at the draft ANSI standard, and I can find no examples that look like ` const *;'. Due to the fact that the C declaration syntax is so complex, I don't even want to try to think about the issue of whether or not such declarations are syntactically legal. So let me just ask the general question: "Are such declarations both syntactically and semantically legal?" Please excuse me if this question seems excessively naive. It is just that I have never before seen any declarations of this form. One other question. If this form of declaration *is* legal, then does the standard contain any verbage which would clarify the type of `bar' in the following example? void foo (char const bar[]) { } GCC accepts this declaration, and it binds the `const' with lower `priority' that the `[]'. Thus, the type of `bar' is taken as pointer to constant char. I have found no basis in the standard for either this binding *or* for the other alternative (i.e. binding the `const' more tightly than the `[]'). Did I miss something? Which binding is "correct"? Why? // rfg