Complete floating point literals
Daniel Gibson
metalcaedes at gmail.com
Sat Jul 9 12:17:13 PDT 2011
Am 09.07.2011 21:13, schrieb bearophile:
> This comes from a small sub-thread in D.learn (but I have asked for it the first time in bug 3837 time ago):
> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=28030
>
> I suggest to turn floating point literals like the following into syntax errors (maybe just deprecated, so they get accepted using the -d compiler switch), because the saving of one digit is not worth the small troubles they cause now and then:
>
> .5
> 3.
>
> And require to write them like this:
>
> 0.5
> 3.0
>
> The enhancement request:
> http://d.puremagic.com/issues/show_bug.cgi?id=6277
>
> (Daniel Murphy suggests to allow 1.f and 1.L (and maybe .2f and .2L too) but I think this is a special case).
>
> (I think disallowing 3. is also useful if you want to allow the introduction of the .. or ... interval syntax. The trailing FP dot causes some troubles and asks for an extra space).
>
> What do you think?
>
> If I see enough people against this idea I will probably close the enhancement request.
>
> Bye,
> bearophile
I voted for it.
And I don't think the special cases 1.f and 1.L are needed, but would
impair consistency (typing 1.0f is just one additional character, so why
bother...)
Cheers,
- Daniel
More information about the Digitalmars-d
mailing list