[Issue 3837] New: Safer number literals
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Feb 18 13:25:36 PST 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3837
Summary: Safer number literals
Product: D
Version: 2.040
Platform: Other
OS/Version: Windows
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2010-02-18 13:25:35 PST ---
Octal numbers are not common, but sometimes less experienced programmers can
add leading zeros to align numbers or for other purposes, and this can cause
bugs:
int x = 010;
This assigns x to value 8.
To avoid that bug D can turn leading zeros in syntax errors (for safety with
code ported from C to D), and a safer syntax can be introduced for octal
literals, for example like in Python3 (or some other syntax can be invented):
0o10
0O10
Optionally D can also turn FP literals like the following into syntax errors:
.5
3.
To require something like:
0.5
3.0
But this is less important than the octal syntax.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list