type *var -- vs. -- type* var

Tom Karzes karzes at mfci.UUCP
Tue Sep 12 05:41:27 AEST 1989


In article <10992 at smoke.BRL.MIL> gwyn at brl.arpa (Doug Gwyn) writes:
>In article <12813 at pur-ee.UUCP> lewie at ecn-ee.UUCP writes:
>>Because there's no explicit separator between declarations and statements,
>>you'll never be able to declare pointers as such.  Isn't C syntax fun?
>
>I don't know what you're talking about; do you?

I don't think you were paying close enough attention to this discussion.
Yes, he knows what he's talking about.  His point was that if the following
is seen in a routine (amidst declarations):

    (int *) x, y, z;

then it will be parsed as a comma expression and the (int *) would be
parsed as a cast.  It certainly won't serve as a declaration of three
pointers to ints, which is what was desired.  Furthermore, because it
is already legal syntax for an expression, and because the parser would
have no way of knowing when the declaration section of a block has ended
until it sees a statement (this is what he meant about no explicit
separator), he is pointing out that C could not be compatibly extended
to accept this syntax for declarations.  Hence, you'll never be able
to declare pointers as such (using the above syntax).

>Anyone who programs in C frequently declares pointers as such.

This statement is a nonsequitur.  C programmers do frequently declare
pointers to ints, but they certainly don't use the above syntax to do
so, which is what you unwittingly claimed.



More information about the Comp.lang.c mailing list