Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #61163

Re: Syntax error?

From Ben Bacarisse <ben.lists@bsb.me.uk>
Newsgroups comp.lang.c
Subject Re: Syntax error?
Date 2015-04-27 01:53 +0100
Organization A noiseless patient Spider
Message-ID <87pp6q1jek.fsf@bsb.me.uk> (permalink)
References (1 earlier) <mhiaif$7fj$1@news.albasani.net> <mhidu2$igd$1@dont-email.me> <mhif2c$mkd$1@dont-email.me> <87vbgj12rj.fsf@bsb.me.uk> <mhjaka$3ja$1@dont-email.me>

Show all headers | View raw


Bartc <bc@freeuk.com> writes:

> On 26/04/2015 13:40, Ben Bacarisse wrote:
>> Bartc <bc@freeuk.com> writes:
>> <snip>
>>> Also, there is this example:
>>>
>>> int *fred(int);   // prototype for above
>>> int *ptr;         // pointer to int
>>>
>>> If I add parentheses around the *name parts:
>>>
>>> int (*fred)(int);
>>> int (*ptr);
>>>
>>> The int pointer is unaffected, but the first line now turns from a
>>> function returning a pointer, to a pointer to a function!
>>
>> Of course.  Randomly adding parentheses into some syntax may alter the
>> meaning.  I really don't think that needs an exclamation mark.  I get
>> that you don't like the syntax, but this most recent objection to it --
>> that it is not immune to the insertion of key syntactic elements -- is
>> just daft.
>
> No, it's the syntax that's daft, and that's a fact, not just my
> opinion (even cdecl.org calls it 'gibberish').

I agree that the option is held by others but I'd expect more than you
offer to accept it as a fact

> Because is not taking a+b*c and turning it into (a+b)*c. It's more
> like turning it into (a)+b*c and the meaning changing completely, when
> a' is a function, and staying exactly the same when 'a' isn't a
> function.

Not at all.  You marvel that int (*f)() and int *f() are entirely
different declarations because you pretend not to know that *, (...) and
[...] act like type operators with postfix operators binding more
tightly than prefix ones.  Do you marvel that (*f)() and *f() are
different expressions?

<snip>
-- 
Ben.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Syntax error? Bartc <bc@freeuk.com> - 2015-04-25 13:19 +0100
  Re: Syntax error? Richard Damon <Richard@Damon-Family.org> - 2015-04-25 11:07 -0400
  Re: Syntax error? jacobnavia <jacob@jacob.remcomp.fr> - 2015-04-25 18:03 +0200
    Re: Syntax error? Bartc <bc@freeuk.com> - 2015-04-25 17:26 +0100
      Re: Syntax error? jacobnavia <jacob@jacob.remcomp.fr> - 2015-04-25 19:28 +0200
  Re: Syntax error? Johannes Bauer <dfnsonfsduifb@gmx.de> - 2015-04-26 11:19 +0200
    Re: Syntax error? Bartc <bc@freeuk.com> - 2015-04-26 11:17 +0100
      Re: Syntax error? Bartc <bc@freeuk.com> - 2015-04-26 11:36 +0100
        Re: Syntax error? Ben Bacarisse <ben.lists@bsb.me.uk> - 2015-04-26 13:40 +0100
          Re: Syntax error? Bartc <bc@freeuk.com> - 2015-04-26 19:27 +0100
            Re: Syntax error? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-04-26 12:38 -0700
              Re: Syntax error? Bartc <bc@freeuk.com> - 2015-04-26 22:26 +0100
            Re: Syntax error? Keith Thompson <kst-u@mib.org> - 2015-04-26 12:41 -0700
            Re: Syntax error? Ben Bacarisse <ben.lists@bsb.me.uk> - 2015-04-27 01:53 +0100
      Re: Syntax error? Bartc <bc@freeuk.com> - 2015-04-26 13:24 +0100
  Re: Syntax error? Tim Rentsch <txr@alumni.caltech.edu> - 2015-04-26 07:01 -0700
    Re: Syntax error? Bartc <bc@freeuk.com> - 2015-04-26 19:55 +0100
      Re: Syntax error? Robert Wessel <robertwessel2@yahoo.com> - 2015-04-27 02:39 -0500
      Re: Syntax error? Tim Rentsch <txr@alumni.caltech.edu> - 2015-04-28 08:34 -0700

csiph-web