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


Groups > comp.lang.c > #22601

Re: C scope and struct definitions

From pacman@kosh.dhis.org (Alan Curry)
Newsgroups comp.lang.c
Subject Re: C scope and struct definitions
Date 2012-06-24 06:03 +0000
Organization Aioe.org NNTP Server
Message-ID <js6aiq$a83$1@speranza.aioe.org> (permalink)
References <mYGdnXsGt41dNnnSnZ2dnUVZ_u-dnZ2d@bestweb.net> <js5l0m$64l$1@dont-email.me> <js5oki$9m3$1@speranza.aioe.org> <js5rl3$5pf$1@dont-email.me>

Show all headers | View raw


In article <js5rl3$5pf$1@dont-email.me>,
Eric Sosman  <esosman@ieee-dot-org.invalid> wrote:
>On 6/23/2012 8:56 PM, Alan Curry wrote:
>> In article <js5l0m$64l$1@dont-email.me>,
>
>> Anyway, putting type names and variable names into a single category and
>> calling them "identifiers" is a false generalization.
>
>     If type names are somehow segregated from names-of-other-things,
>does that mean
>
>	double int = 42;
>	long * double void(short long);
>	struct struct { long *union; char enum; };
>
>... are to your liking?

That would depend on whether it adds any conflicts to the grammar. If not, go
for it. We already allow this:

  struct foo { int i; };
  struct bar { short x,y; };
  typedef struct bar bar;
  static struct foo foo(bar foo, bar bar) { }

although it doesn't look very good. But this:

  int stat(const char *, struct stat *);

has been a respectable function for a long time.

>
>     (In my early youth I was weaned on a language that had no
>reserved words at all, a language in which `DO 10 I = (1 , 10)'
>was perfectly legal and *not* a loop construct.  For a while I
>esteemed this as a sort of Purity.  I got over it.)

I had the opposite of that experience, CBM BASIC. You can't have a variable
name that contains a keyword as a substring, because keywords are recognized
regardless of the lack of spacing around them. Luckily there are only 2
significant characters in a variable name so you'd never have a problem
unless you flamboyantly extended your variable names with insignificant
characters.

>
>     But, hey: Back to the beginning.  You asked whether a compiler
>that obeyed 6.2.1p4 did so quote "for a real reason" end quote.
>The answer to your question is "Yes," because 6.2.1p4 dictates
>how the compiler must behave.  Debate about whether 6.2.1p4 ought
>to have said something else should be between you and X3J11, not
>between you and me.

Standards aren't reasons at all. Official rationale is supplied for a few
things, the rest is just a record of decisions made and the reasons are found
elsewhere in history.

-- 
Alan Curry

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


Thread

C scope and struct definitions Kenneth Brody <kenbrody@spamcop.net> - 2012-06-22 13:30 -0400
  Re: C scope and struct definitions Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-22 14:02 -0400
    Re: C scope and struct definitions pacman@kosh.dhis.org (Alan Curry) - 2012-06-22 22:40 +0000
      Re: C scope and struct definitions Ben Pfaff <blp@cs.stanford.edu> - 2012-06-22 15:47 -0700
      Re: C scope and struct definitions Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-22 20:32 -0400
        Re: C scope and struct definitions pacman@kosh.dhis.org (Alan Curry) - 2012-06-23 22:06 +0000
          Re: C scope and struct definitions Keith Thompson <kst-u@mib.org> - 2012-06-23 16:18 -0700
            Re: C scope and struct definitions James Kuyper <jameskuyper@verizon.net> - 2012-06-25 10:19 -0400
              Re: C scope and struct definitions Keith Thompson <kst-u@mib.org> - 2012-06-25 11:51 -0700
          Re: C scope and struct definitions Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-23 19:54 -0400
            Re: C scope and struct definitions pacman@kosh.dhis.org (Alan Curry) - 2012-06-24 00:56 +0000
              Re: C scope and struct definitions Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-23 21:48 -0400
                Re: C scope and struct definitions pacman@kosh.dhis.org (Alan Curry) - 2012-06-24 06:03 +0000
                Re: C scope and struct definitions nick_keighley_nospam@hotmail.com - 2012-06-25 00:05 -0700
              Re: C scope and struct definitions Keith Thompson <kst-u@mib.org> - 2012-06-23 19:25 -0700
                Re: C scope and struct definitions pacman@kosh.dhis.org (Alan Curry) - 2012-06-24 05:40 +0000
                Re: C scope and struct definitions Jens Gustedt <jens.gustedt@loria.fr> - 2012-06-24 10:47 +0200
                Re: C scope and struct definitions Keith Thompson <kst-u@mib.org> - 2012-06-24 11:00 -0700
                Re: C scope and struct definitions pacman@kosh.dhis.org (Alan Curry) - 2012-06-25 03:53 +0000
                Re: C scope and struct definitions Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-25 01:14 -0400
                Re: C scope and struct definitions Keith Thompson <kst-u@mib.org> - 2012-06-24 22:38 -0700
                Re: C scope and struct definitions Kenneth Brody <kenbrody@spamcop.net> - 2012-06-25 11:03 -0400
                Re: C scope and struct definitions pacman@kosh.dhis.org (Alan Curry) - 2012-06-26 20:08 +0000
                Re: C scope and struct definitions Jens Gustedt <jens.gustedt@loria.fr> - 2012-06-26 23:21 +0200
                Re: C scope and struct definitions pacman@kosh.dhis.org (Alan Curry) - 2012-06-26 21:47 +0000
                Re: C scope and struct definitions Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-26 18:05 -0400
                Re: C scope and struct definitions Keith Thompson <kst-u@mib.org> - 2012-06-26 16:45 -0700
                Re: C scope and struct definitions Jens Gustedt <jens.gustedt@loria.fr> - 2012-06-27 08:26 +0200
                Re: C scope and struct definitions Keith Thompson <kst-u@mib.org> - 2012-06-27 00:01 -0700
                Re: C scope and struct definitions James Kuyper <jameskuyper@verizon.net> - 2012-06-27 06:57 -0400
                Re: C scope and struct definitions James Kuyper <jameskuyper@verizon.net> - 2012-06-27 15:00 -0400
                Re: C scope and struct definitions Keith Thompson <kst-u@mib.org> - 2012-06-27 14:48 -0700
                Re: C scope and struct definitions Tim Rentsch <txr@alumni.caltech.edu> - 2012-06-27 16:14 -0700
                Re: C scope and struct definitions Tim Rentsch <txr@alumni.caltech.edu> - 2012-06-29 09:36 -0700
                Re: C scope and struct definitions Tim Rentsch <txr@alumni.caltech.edu> - 2012-06-27 16:27 -0700
                Re: C scope and struct definitions Keith Thompson <kst-u@mib.org> - 2012-06-27 12:03 -0700
                Re: C scope and struct definitions Keith Thompson <kst-u@mib.org> - 2012-06-27 12:11 -0700
                Re: C scope and struct definitions Tim Rentsch <txr@alumni.caltech.edu> - 2012-06-27 15:53 -0700
                Re: C scope and struct definitions Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-26 17:59 -0400
                Re: C scope and struct definitions pacman@kosh.dhis.org (Alan Curry) - 2012-06-26 22:18 +0000
                Re: C scope and struct definitions Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-26 18:33 -0400
                Re: C scope and struct definitions Keith Thompson <kst-u@mib.org> - 2012-06-26 17:22 -0700
                Re: C scope and struct definitions Keith Thompson <kst-u@mib.org> - 2012-06-27 00:03 -0700
                Re: C scope and struct definitions Kenneth Brody <kenbrody@spamcop.net> - 2012-06-27 14:13 -0400
                Re: C scope and struct definitions Keith Thompson <kst-u@mib.org> - 2012-06-27 12:15 -0700
                Re: C scope and struct definitions Tim Rentsch <txr@alumni.caltech.edu> - 2012-06-29 09:43 -0700
                Re: C scope and struct definitions Keith Thompson <kst-u@mib.org> - 2012-06-29 11:59 -0700
                Re: C scope and struct definitions Tim Rentsch <txr@alumni.caltech.edu> - 2012-07-01 18:32 -0700
                Re: C scope and struct definitions pacman@kosh.dhis.org (Alan Curry) - 2012-06-27 20:59 +0000
                Re: C scope and struct definitions Kenneth Brody <kenbrody@spamcop.net> - 2012-06-28 16:42 -0400
            Re: C scope and struct definitions James Kuyper <jameskuyper@verizon.net> - 2012-06-23 20:57 -0400
              Re: C scope and struct definitions Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-23 22:11 -0400
                Re: C scope and struct definitions James Kuyper <jameskuyper@verizon.net> - 2012-06-23 22:51 -0400
                Re: C scope and struct definitions Nick Bowler <nbowler@draconx.ca> - 2012-06-25 17:31 +0000
                Re: C scope and struct definitions James Kuyper <jameskuyper@verizon.net> - 2012-06-25 14:46 -0400
                Re: C scope and struct definitions Tim Rentsch <txr@alumni.caltech.edu> - 2012-06-25 14:43 -0700
                Re: C scope and struct definitions Jens Gustedt <jens.gustedt@loria.fr> - 2012-06-26 13:44 +0200
                Re: C scope and struct definitions Keith Thompson <kst-u@mib.org> - 2012-06-23 20:07 -0700
              Re: C scope and struct definitions Jens Gustedt <jens.gustedt@loria.fr> - 2012-06-24 10:56 +0200
                Re: C scope and struct definitions James Kuyper <jameskuyper@verizon.net> - 2012-06-24 08:29 -0400
              Re: C scope and struct definitions Tim Rentsch <txr@alumni.caltech.edu> - 2012-06-24 10:26 -0700
          Re: C scope and struct definitions Kenneth Brody <kenbrody@spamcop.net> - 2012-06-25 10:50 -0400
      Re: C scope and struct definitions Tim Rentsch <txr@alumni.caltech.edu> - 2012-06-24 09:23 -0700
        Re: C scope and struct definitions Kenneth Brody <kenbrody@spamcop.net> - 2012-06-25 11:17 -0400
          Re: C scope and struct definitions Tim Rentsch <txr@alumni.caltech.edu> - 2012-06-25 14:22 -0700
  Re: C scope and struct definitions Kenneth Brody <kenbrody@spamcop.net> - 2012-06-25 11:11 -0400

csiph-web