[Issue 3827] Warn against and then deprecate implicit concatenation of adjacent string literals

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Apr 27 03:32:38 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=3827

--- Comment #32 from bearophile_hugs at eml.cc ---
A new bug of mine caused by the implicit concatenation of strings. The point of
this little program is to show the Phobos isNumeric function:


void main() {
    import std.stdio, std.string, std.array;

    foreach (const s; ["12", " 12\t", "hello12", "-12", "02"
                 "0-12", "+12", "1.5", "1,000", "1_000",
                 "0x10", "0b10101111_11110000_11110000_00110011",
                 "-0b10101", "0x10.5"])
        writefln(`isNumeric("%s"): %s`, s, s.strip().isNumeric(true));
}


As you see the last example "02" of the first row of the array literal lacks a
comma.

I have found this bug with the DScanner tool.

--


More information about the Digitalmars-d-bugs mailing list