Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #112132
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Hexadecimal float constants |
| Date | 2017-06-13 13:12 -0700 |
| Organization | None to speak of |
| Message-ID | <lntw3jejfi.fsf@kst-u.example.com> (permalink) |
| References | (3 earlier) <27beaf10-7fcd-4323-813f-8cec20202fd7@googlegroups.com> <lnlgowg3ja.fsf@kst-u.example.com> <4996d741-d2cf-42a6-8515-02a0e954bf09@googlegroups.com> <lnefung8ui.fsf@kst-u.example.com> <2984425d-ddc3-4b98-9eed-244d917c9393@googlegroups.com> |
supercat@casperkitty.com writes:
[...]
> For what purposes would a compiler that cannot usefully process 0x1e-4
> more useful than one that processes it as three tokens? The only "purpose"
> I can see that is served by forbidding such treatment is that it avoids
> the need to tell all the people who added extra code to their compilers
> for the purpose of rejecting that construct that they wasted their time
> on code that never served any useful purpose.
Suppose compiler A follows the standard and flags `0x1e-4` as
a constraint violation, while compiler B quietly treats it as
equivalent to `0x1e - 4`.
Personally, I prefer compiler A simply because it conforms to
the C standard. I can use the standard as a reference for what
it will or will not accept, for features like this that are not
implementation-defined.
As a more practical matter, suppose I'm using compiler B, and for
whatever reason I write `0x1e-4` in my code. The compiler will
not diagnose the error. Months later, I or someone else tries to
compile my code using the conforming compiler A, and it's rejected.
I have to change the code, perhaps at considerable expense, to allow
for compiler B's non-conconformance. I prefer errors to be caught
as early as possible.
If the ability to write 0x1e-4 is more important to you than
conformance to the C standard, then we have vastly different
priorities.
As for the "extra code", I would expect that the code that implements
the preprocessor simply follows the syntax of a PP-number, and
the code that implements translation phase 7 follows the syntax of
numeric constants. And for most compilers, that work has already
been done.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Hexadecimal float constants Steve Keller <keller@no.invalid> - 2017-06-12 18:34 +0200
Re: Hexadecimal float constants "James R. Kuyper" <jameskuyper@verizon.net> - 2017-06-12 12:44 -0400
Re: Hexadecimal float constants supercat@casperkitty.com - 2017-06-12 10:54 -0700
Re: Hexadecimal float constants Keith Thompson <kst-u@mib.org> - 2017-06-12 11:26 -0700
Re: Hexadecimal float constants bartc <bc@freeuk.com> - 2017-06-12 19:38 +0100
Re: Hexadecimal float constants scott@slp53.sl.home (Scott Lurndal) - 2017-06-12 18:45 +0000
Re: Hexadecimal float constants Robert Wessel <robertwessel2@yahoo.com> - 2017-06-12 13:54 -0500
Re: Hexadecimal float constants bartc <bc@freeuk.com> - 2017-06-12 20:40 +0100
Re: Hexadecimal float constants Keith Thompson <kst-u@mib.org> - 2017-06-12 13:06 -0700
Re: Hexadecimal float constants supercat@casperkitty.com - 2017-06-12 13:37 -0700
Re: Hexadecimal float constants bartc <bc@freeuk.com> - 2017-06-12 22:22 +0100
Re: Hexadecimal float constants Keith Thompson <kst-u@mib.org> - 2017-06-12 16:01 -0700
Re: Hexadecimal float constants supercat@casperkitty.com - 2017-06-12 16:36 -0700
Re: Hexadecimal float constants jameskuyper@verizon.net - 2017-06-12 12:39 -0700
Re: Hexadecimal float constants bartc <bc@freeuk.com> - 2017-06-12 18:42 +0100
Re: Hexadecimal float constants Thomas David Rivers <rivers@dignus.com> - 2017-06-12 17:27 -0400
Re: Hexadecimal float constants "James R. Kuyper" <jameskuyper@verizon.net> - 2017-06-12 18:03 -0400
Re: Hexadecimal float constants bartc <bc@freeuk.com> - 2017-06-12 23:31 +0100
Re: Hexadecimal float constants Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-06-13 00:10 +0100
Re: Hexadecimal float constants jacobnavia <jacob@jacob.remcomp.fr> - 2017-06-13 01:33 +0200
Re: Hexadecimal float constants Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-06-13 01:10 +0100
Re: Hexadecimal float constants supercat@casperkitty.com - 2017-06-12 16:01 -0700
Re: Hexadecimal float constants Keith Thompson <kst-u@mib.org> - 2017-06-12 17:00 -0700
Re: Hexadecimal float constants supercat@casperkitty.com - 2017-06-13 07:51 -0700
Re: Hexadecimal float constants Keith Thompson <kst-u@mib.org> - 2017-06-13 09:17 -0700
Re: Hexadecimal float constants bartc <bc@freeuk.com> - 2017-06-13 17:45 +0100
Re: Hexadecimal float constants Keith Thompson <kst-u@mib.org> - 2017-06-13 11:58 -0700
Re: Hexadecimal float constants supercat@casperkitty.com - 2017-06-13 12:57 -0700
Re: Hexadecimal float constants Keith Thompson <kst-u@mib.org> - 2017-06-13 13:01 -0700
Re: Hexadecimal float constants bartc <bc@freeuk.com> - 2017-06-13 22:11 +0100
Re: Hexadecimal float constants Keith Thompson <kst-u@mib.org> - 2017-06-13 14:22 -0700
Re: Hexadecimal float constants "James R. Kuyper" <jameskuyper@verizon.net> - 2017-06-13 17:43 -0400
Re: Hexadecimal float constants Keith Thompson <kst-u@mib.org> - 2017-06-13 14:48 -0700
Re: Hexadecimal float constants bartc <bc@freeuk.com> - 2017-06-13 23:03 +0100
Re: Hexadecimal float constants GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-06-14 01:30 +0200
Re: Hexadecimal float constants supercat@casperkitty.com - 2017-06-13 12:24 -0700
Re: Hexadecimal float constants jacobnavia <jacob@jacob.remcomp.fr> - 2017-06-13 21:52 +0200
Re: Hexadecimal float constants Keith Thompson <kst-u@mib.org> - 2017-06-13 13:12 -0700
Re: Hexadecimal float constants supercat@casperkitty.com - 2017-06-13 16:18 -0700
Re: Hexadecimal float constants Ike Naar <ike@iceland.freeshell.org> - 2017-06-14 21:28 +0000
Re: Hexadecimal float constants supercat@casperkitty.com - 2017-06-12 15:21 -0700
Re: Hexadecimal float constants Thomas David Rivers <rivers@dignus.com> - 2017-06-13 12:13 -0400
csiph-web