Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #112110
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Hexadecimal float constants |
| Date | 2017-06-13 09:17 -0700 |
| Organization | None to speak of |
| Message-ID | <lnefung8ui.fsf@kst-u.example.com> (permalink) |
| References | (1 earlier) <593F0753.9040003@dignus.com> <b401da97-da04-bf4d-0db1-1a62098725e8@verizon.net> <27beaf10-7fcd-4323-813f-8cec20202fd7@googlegroups.com> <lnlgowg3ja.fsf@kst-u.example.com> <4996d741-d2cf-42a6-8515-02a0e954bf09@googlegroups.com> |
supercat@casperkitty.com writes:
> On Monday, June 12, 2017 at 7:00:45 PM UTC-5, Keith Thompson wrote:
>> supercat writes:
>> > Say that a PP-number contains a 0-9 followed by any subsequent characters
>> > matching [0-9A-Za-z\.] would entail fewer rules.
>>
>> And it would mean that .123 is not a PP-number.
>
> I hadn't considered that case, but that could be handled by saying a period
> followed by [0-9] will be regarded as the first digit of a PP-number--a
> special-case rule that would needed under the Standard's rules to handle
> the fact that an "e" or "E" may follow a period that's preceded by at
> least one digit, but neither .e nor .E can mark the start of a PP-number.
So you want to say that `.3` is a "digit" if it appears at the
beginning of a PP-number? Just how complicated and counterintuitive
are you willing to make this?
I can think of two reasonable ways to handle this.
One is the approach taken by the current standard. A PP-number
has a syntax that covers all numeric constants (decimal, octal,
and hexadecimal integer constants, and decimal and hexadecimal
floating constants, all with or without a suffix). In phase 7,
each PP-number is translated to a constant. Failing to satisfy
the syntax of a constant is a constraint violation.
The other is to drop the idea of PP-numbers and have the preprocessor
recognize numeric constants, using the same grammar used in phase 7.
If I were designing the language from scratch today, I'd probably
go with the second approach. It's simpler and has no particular
disadvantages that I can think of. (There may be some that I
haven't thought of.)
Changing from the current approach to the second one in a future
standard might break some highly contrived code (I haven't taken
the time to think of any examples), but I wouldn't consider that
a deal breaker. In my opinion, such a change wouldn't solve any
serious problems and wouldn't be worth the effort.
I'm aware that, for example, 0x1e-1 is invalid under the current
rules, and that one might reasonably assume that it's equivalent to
0x1e - 1 -- but I do not care enough to want to change the language.
[...]
--
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