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


Groups > comp.lang.c > #102913

Re: C declarations

From BartC <bc@freeuk.com>
Newsgroups comp.lang.c
Subject Re: C declarations
Date 2017-02-01 17:04 +0000
Organization A noiseless patient Spider
Message-ID <o6t4cc$gd6$1@dont-email.me> (permalink)
References (6 earlier) <o6s8i9$cuj$1@dont-email.me> <o6sha6$a6l$1@dont-email.me> <o6slob$pkf$1@dont-email.me> <o6snb9$v37$1@dont-email.me> <o6suqv$q9r$1@dont-email.me>

Show all headers | View raw


On 01/02/2017 15:30, David Brown wrote:
> On 01/02/17 14:22, BartC wrote:
>> On 01/02/2017 12:55, David Brown wrote:

>>> Section 6.7.2 of N1570 (C11 draft) seems reasonably clear to me.  "int
>>> int" is not allowed - you can have /one/ list of type specifier from the
>>> list given under "constraints".
>>
>> Oh, OK, I didn't get that far!
>
> How can you be writing a parser, and complaining about what C does and
> does not allow, and how other compilers match the standards, when you
> haven't even bothered to /read/ the standards?

I started reading 6.7 about decl-specs without realising that type-specs 
(part of a decl-spec) had their own section. Anyway I already knew most 
of the restrictions but they were not stipulated by means of the grammar.

> How are you making
> making your code at the moment - by skim-reading a couple of Wikipedia
> articles then some trial-and-error runs with a few existing compilers?

So far I do trial runs with code fragments, then do proper testing using 
hundreds of thousands of lines of real code. One test file has nearly 
900,000 lines in a single module when 650 headers are included.

But my emphasis is on streamlining for speed.

>> But it has to resort to listing all the
>> combinations (but not the permutations) that are allowed. And which may
>> be intermixed with other attributes. This is not very elegant (nor
>> efficient) to parse and to check.
>
> The language has historical baggage.  This is no surprise - its 40 years
> old and has gone through many revisions.  Originally there was only
> "int" and "double", and other types had to be added in a way that
> allowed existing code to keep working.  The result is a bit less
> consistent than if it had been designed with advice from
> time-travellers.

I wasn't involved with computing when C was designed, but I was a decade 
later. And the languages I started to create then /had/ to be quick and 
easy to compile, so they needed to be simple.

I know for a fact (even if other details have faded), then I did not 
cripple the designs by mandating an intermediate macro-language that 
pre-processed source code by means of a pure interpreter implemented 
within the compiler! It sounds crazy when put that way, but that's 
exactly how it works in C.

-- 
bartc

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


Thread

C declarations BartC <bc@freeuk.com> - 2017-01-30 13:00 +0000
  Re: C declarations David Brown <david.brown@hesbynett.no> - 2017-01-30 14:25 +0100
    Re: C declarations Keith Thompson <kst-u@mib.org> - 2017-01-30 11:42 -0800
  Re: C declarations Andrey Tarasevich <andreytarasevich@hotmail.com> - 2017-01-31 13:46 -0800
    Re: C declarations BartC <bc@freeuk.com> - 2017-01-31 22:13 +0000
      Re: C declarations Andrey Tarasevich <andreytarasevich@hotmail.com> - 2017-01-31 16:43 -0800
        Re: C declarations Andrey Tarasevich <andreytarasevich@hotmail.com> - 2017-01-31 17:06 -0800
      Re: C declarations Ian Collins <ian-news@hotmail.com> - 2017-02-01 17:58 +1300
        Re: C declarations luser droog <luser.droog@gmail.com> - 2017-01-31 22:42 -0800
          Re: C declarations Ian Collins <ian-news@hotmail.com> - 2017-02-01 19:48 +1300
            Re: C declarations Robert Wessel <robertwessel2@yahoo.com> - 2017-02-01 01:18 -0600
            Re: C declarations David Brown <david.brown@hesbynett.no> - 2017-02-01 10:10 +0100
              Re: C declarations BartC <bc@freeuk.com> - 2017-02-01 11:39 +0000
                Re: C declarations David Brown <david.brown@hesbynett.no> - 2017-02-01 13:55 +0100
                Re: C declarations BartC <bc@freeuk.com> - 2017-02-01 13:22 +0000
                Re: C declarations David Brown <david.brown@hesbynett.no> - 2017-02-01 16:30 +0100
                Re: C declarations Keith Thompson <kst-u@mib.org> - 2017-02-01 08:15 -0800
                Re: C declarations supercat@casperkitty.com - 2017-02-01 08:44 -0800
                Re: C declarations David Brown <david.brown@hesbynett.no> - 2017-02-01 20:56 +0100
                Re: C declarations supercat@casperkitty.com - 2017-02-01 08:29 -0800
                Re: C declarations BartC <bc@freeuk.com> - 2017-02-01 17:24 +0000
                Re: C declarations fir <profesor.fir@gmail.com> - 2017-02-01 09:55 -0800
                Re: C declarations BartC <bc@freeuk.com> - 2017-02-01 18:44 +0000
                Re: C declarations Keith Thompson <kst-u@mib.org> - 2017-02-01 11:03 -0800
                Re: C declarations fir <profesor.fir@gmail.com> - 2017-02-01 12:26 -0800
                Re: C declarations fir <profesor.fir@gmail.com> - 2017-02-01 13:03 -0800
                Re: C declarations fir <profesor.fir@gmail.com> - 2017-02-01 13:12 -0800
                Re: C declarations fir <profesor.fir@gmail.com> - 2017-02-03 16:07 -0800
                Re: C declarations Keith Thompson <kst-u@mib.org> - 2017-02-01 10:44 -0800
                Re: C declarations jameskuyper@verizon.net - 2017-02-01 11:08 -0800
                Re: C declarations Keith Thompson <kst-u@mib.org> - 2017-02-01 10:40 -0800
                Re: C declarations BartC <bc@freeuk.com> - 2017-02-01 17:04 +0000
                Re: C declarations Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-02-01 19:58 +0000
                Re: C declarations BartC <bc@freeuk.com> - 2017-02-01 21:23 +0000
                Re: C declarations Keith Thompson <kst-u@mib.org> - 2017-02-01 08:08 -0800
                Re: C declarations Andrey Tarasevich <andreytarasevich@hotmail.com> - 2017-02-01 12:45 -0800
  Re: C declarations Andrey Tarasevich <andreytarasevich@hotmail.com> - 2017-03-06 11:19 -0800
    Re: C declarations Keith Thompson <kst-u@mib.org> - 2017-03-06 11:27 -0800

csiph-web