Re: Pointers

From: Keith Thompson (kst-u_at_mib.org)
Date: 03/12/05


Date: Sat, 12 Mar 2005 03:09:43 GMT

Thomas Stegen <thomas.stegen@gmail.com> writes:
> Keith Thompson wrote:
>
>> I'll grant you that C's declaration syntax can be confusing. I don't
>> think it's a fatal flaw in the language. If you understand it well,
>> you can use it properly; if you don't, there are ways to avoid the
>> complexity in code you write, and tools to decipher complex
>> declarations in code you read.
>
> I am not saying it is difficult, just that is not as easy and clear
> as it could have been.
>
>> The declaration that was said to be "incorrect" was:
>> char *a, b;
>
> It was
>
> char* a, b;

Ok, but that's effectively identical (as you know).

> That was seen as "incorrect" IIRC.
>
>> It's not "seen as incorrect syntactically" by anyone who understands
>> the language well enough.
>
> My point was that if something is not seen as a flaw in the language
> it should not be considered "incorrect" either. Do you agree on this
> point, (agreeing or disagreeing here has nothing to do with whether
> you think the declaration syntax is flawed or not).

Incorrect in what sense? I don't see the fact that
    char* a, b;
declare a as a pointer-to-char and b as a char as a flaw in the
language. Whether that line is (logically) incorrect depends on the
programmer's intent.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center             <*>  <http://users.sdsc.edu/~kst>
We must do something.  This is something.  Therefore, we must do this.


Relevant Pages

  • Re: Pointers
    ... > think it's a fatal flaw in the language. ... That was seen as "incorrect" IIRC. ... you think the declaration syntax is flawed or not). ...
    (comp.lang.c)
  • Re: Pointers
    ... > incorrect it is not a language flaw. ... As far as the language is concerned, ... for poorly formatted code to be a flaw in the ... Keith Thompson kst-u@mib.org ...
    (comp.lang.c)