Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #103747
| From | BartC <bc@freeuk.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: better atoi |
| Date | 2017-02-12 18:32 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <o7q9kb$dcr$1@dont-email.me> (permalink) |
| References | (10 earlier) <aae7f429-49c0-562c-b96c-30ca65f21343@verizon.net> <01bd8443-f20c-4183-8df7-c23b93b6887b@googlegroups.com> <649395f0-f6fa-4779-b563-71527b7e677c@googlegroups.com> <a0b5a4f1-4e7b-41d6-88b8-d63a0de85a4c@googlegroups.com> <491bde1c-4dc9-4c49-ab7c-496eb64f4362@googlegroups.com> |
On 12/02/2017 17:44, Malcolm McLean wrote:
> On Sunday, February 12, 2017 at 5:16:00 PM UTC, fir wrote:
>>
>> i dislike reading standards - it was mentioned that they
>> use not clear language even for native englishmen - so it
>> seems is badly written despite if so (undocumented my change errno)
>> is (or at least seems) silly to me
>>
>> duh, i realized now that i forgot to check also for out of range
>> in those examples of strtol /digint, must revrite again
>>
> Standards are mainly aimed at those implementing compilers.
They don't seem to be much use for that either, as I'm finding out. Not
for C anyway.
The Standard is convoluted because the language is convoluted. They
could have fixed that in the very early days, as they did with BCPL and
B which didn't seem to last long, but C presumably must have been
perfect because few of the troublesome details has been touched for decades!
(The type declaration system in particular is a masterpiece of design,
as I'm finding out this afternoon. First, it is necessary to split all
type declarations into two parts. The first part is the base type, and
might contain, for example, some combination of these keywords:
long int unsigned long
in any order. You can also have const, volatile etc anywhere in the
sequence, and can repeat those as often as you like.
Also added to the mix are typedef, static, extern, which can also appear
anywhere in that sequence (even though it's not part of the type, you
can stick it in the middle of a type!). But you can't repeat those for
some reason like you can with const.
That's Part I of the type. But there could be a Part II, which handles
pointers, arrays and function params. Now, if a name is being declared,
it is necessary for Part II to wrap itself around either side of the
name. If there is no name, then Part II needs to pretend there /is/ a
name to wrap itself around.
If several names are being declared, there it is possible for each to
share the same Part I, but to have its own Part II.
And, just in case you've still got all your own hair, you have an
example like this:
int (*abc)[10];
This follows the recursive definition in the Standard beautifully.
Except the implementation of it doesn't match the grammar: that "*"
pointer somewhere has to find its way outside the brackets, and be
applied to type represented here: int (abc)][10].
..... And this was the simplest and best way they could find of
declaring a type in 1970.)
> It's
> useful to have a copy for reference however. Like the dictionary,
> 99% of it you probably won't read, but still needs to be there.
Yes, so that most compilers can ignore it! Apparently:
int;
is illegal according to the grammar. Yes out of six compilers I tried,
three don't consider that an error, while one just gives a warning.
--
Bartc
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
better atoi fir <profesor.fir@gmail.com> - 2017-02-10 12:24 -0800
Re: better atoi fir <profesor.fir@gmail.com> - 2017-02-10 12:35 -0800
Re: better atoi Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2017-02-10 14:48 -0700
Re: better atoi fir <profesor.fir@gmail.com> - 2017-02-10 14:12 -0800
Re: better atoi Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2017-02-10 22:36 -0700
Re: better atoi fir <profesor.fir@gmail.com> - 2017-02-11 01:07 -0800
Re: better atoi Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2017-02-11 10:10 -0700
Re: better atoi fir <profesor.fir@gmail.com> - 2017-02-11 09:26 -0800
Re: better atoi Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2017-02-11 15:36 -0700
Re: better atoi fir <profesor.fir@gmail.com> - 2017-02-12 00:18 -0800
Re: better atoi fir <profesor.fir@gmail.com> - 2017-02-12 00:31 -0800
Re: better atoi fir <profesor.fir@gmail.com> - 2017-02-12 03:47 -0800
Re: better atoi fir <profesor.fir@gmail.com> - 2017-02-12 04:22 -0800
Re: better atoi fir <profesor.fir@gmail.com> - 2017-02-12 06:08 -0800
Re: better atoi fir <profesor.fir@gmail.com> - 2017-02-12 06:13 -0800
Re: better atoi fir <profesor.fir@gmail.com> - 2017-02-12 07:31 -0800
Re: better atoi fir <profesor.fir@gmail.com> - 2017-02-12 08:02 -0800
Re: better atoi fir <profesor.fir@gmail.com> - 2017-02-12 08:08 -0800
Re: better atoi fir <profesor.fir@gmail.com> - 2017-02-12 08:17 -0800
Re: better atoi fir <profesor.fir@gmail.com> - 2017-02-12 08:23 -0800
Re: better atoi Robert Latest <boblatest@yahoo.com> - 2017-02-19 11:11 +0000
Re: better atoi Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-02-11 17:33 +0000
Re: better atoi Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2017-02-11 15:35 -0700
Re: better atoi "James R. Kuyper" <jameskuyper@verizon.net> - 2017-02-11 17:52 -0500
Re: better atoi Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2017-02-11 18:53 -0700
Re: better atoi Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-02-10 22:50 +0000
Re: better atoi Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2017-02-10 21:59 -0700
Re: better atoi Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-02-11 12:08 +0000
Re: better atoi Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2017-02-11 09:39 -0700
Re: better atoi Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-02-11 17:26 +0000
Re: better atoi Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2017-02-11 15:30 -0700
Re: better atoi Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-02-11 22:58 +0000
Re: better atoi Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2017-02-11 18:48 -0700
Re: better atoi Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-02-12 02:16 +0000
Re: better atoi "James R. Kuyper" <jameskuyper@verizon.net> - 2017-02-12 09:57 -0500
Re: better atoi fir <profesor.fir@gmail.com> - 2017-02-12 07:27 -0800
Re: better atoi jameskuyper@verizon.net - 2017-02-12 08:44 -0800
Re: better atoi fir <profesor.fir@gmail.com> - 2017-02-12 09:15 -0800
Re: better atoi Malcolm McLean <malcolm.mclean5@btinternet.com> - 2017-02-12 09:44 -0800
Re: better atoi BartC <bc@freeuk.com> - 2017-02-12 18:32 +0000
Re: better atoi Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-02-12 18:56 +0000
Re: better atoi BartC <bc@freeuk.com> - 2017-02-12 19:18 +0000
Re: better atoi Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-02-13 00:16 +0000
Re: better atoi BartC <bc@freeuk.com> - 2017-02-13 01:56 +0000
Re: better atoi Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-02-13 10:44 +0000
Re: better atoi BartC <bc@freeuk.com> - 2017-02-13 11:38 +0000
Re: better atoi Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-02-13 14:37 +0000
Re: better atoi BartC <bc@freeuk.com> - 2017-02-13 15:00 +0000
Re: better atoi Keith Thompson <kst-u@mib.org> - 2017-02-12 11:15 -0800
Re: better atoi BartC <bc@freeuk.com> - 2017-02-12 19:25 +0000
Re: better atoi Keith Thompson <kst-u@mib.org> - 2017-02-12 11:54 -0800
Re: better atoi supercat@casperkitty.com - 2017-02-12 13:13 -0800
Re: better atoi Keith Thompson <kst-u@mib.org> - 2017-02-10 15:16 -0800
Re: better atoi Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2017-02-10 22:01 -0700
Re: better atoi Keith Thompson <kst-u@mib.org> - 2017-02-11 01:30 -0800
Re: better atoi Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2017-02-10 22:26 -0700
Re: better atoi Nick Bowler <nbowler@draconx.ca> - 2017-02-11 00:26 +0000
Re: better atoi Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2017-02-10 22:32 -0700
Re: better atoi "James R. Kuyper" <jameskuyper@verizon.net> - 2017-02-19 11:10 -0500
csiph-web