Thread overview
DMD 0.129 release
Aug 07, 2005
Walter
Aug 07, 2005
zwang
Aug 07, 2005
zwang
Re: DMD 0.129 release - string literal postfixes
Aug 07, 2005
David L. Davis
Aug 07, 2005
Uwe Salomon
Aug 07, 2005
Ben Hinkle
Aug 08, 2005
Walter
August 07, 2005
http://www.digitalmars.com/d/changelog.html



August 07, 2005
Walter wrote:
> http://www.digitalmars.com/d/changelog.html
> 
> 
> 

New std.format does not handle bit arrays properly.
Test case:

bit[] ba;
ba ~= false;
ba ~= true;
writef("%s\n", ba); //outputs "[false,false]"
writef("[%s,%s]", ba[0], ba[1]); //outputs "[false,true]"
August 07, 2005
Walter wrote:
> http://www.digitalmars.com/d/changelog.html
> 
> 
> 

The invalid-lvalue-crashes-dmd bug is also fixed.
Maybe that should also be written in the changelog?
August 07, 2005
In article <dd458u$2n3u$1@digitaldaemon.com>, Walter says...
>
>
>http://www.digitalmars.com/d/changelog.html
>
>
>

Walter, thanks for adding the string literal indicators, though I thought they would've have been prefixes instead of postfixes, because of the many posts on the subject back in the days when Jill and others (myself included) requested something like this. But hey, it works, and I'm not about to "kick a gift horse in the mouth!" :)

In my small test below it appears that the 'char' literals are missing this new feature, will you be adding this to them as well?

Thanks for your reply in advance.

# //strtest2.d
# private import std.stdio;
# private import std.stdarg; // for argument gathering
#
# int main()
# {
#     displaytype("ABC"c);
#     displaytype("ABC"w);
#     displaytype("ABC"d);
#
#     // Shouldn't we expect that these new
#     // postfixes to work with the char as well?
#     //displaytype('A'c);
#     //displaytype('B'w);
#     //displaytype('C'd);
#
#     return 0;
# }
#
# void displaytype(...)
# {
#     if (_arguments[0] is typeid(char[]))
#         writefln("Literal \"%s\"c is a UTF8  string",
#                   va_arg!(char[])(_argptr));
#     else if (_arguments[0] is typeid(wchar[]))
#         writefln("Literal \"%s\"w is a UTF16 string",
#                   va_arg!(wchar[])(_argptr));
#     else if (_arguments[0] is typeid(dchar[]))
#         writefln("Literal \"%s\"d is a UTF32 string",
#                   va_arg!(dchar[])(_argptr));
#     else if (_arguments[0] is typeid(char))
#         writefln("Literal '%s'c is a UTF8 char", va_arg!(char)(_argptr));
#     else if (_arguments[0] is typeid(wchar))
#         writefln("Literal '%s'w is a UTF16 char", va_arg!(wchar)(_argptr));
#     else if (_arguments[0] is typeid(dchar))
#         writefln("Literal '%s'd is a UTF32 string", va_arg!(dchar)(_argptr));
# }
#

Output:
----------
C:\dmd>dmd strtest2.d
C:\dmd\bin\..\..\dm\bin\link.exe strtest2,,,user32+kernel32/noi;

C:\dmd>strtest2
Literal "ABC"c is a UTF8  string
Literal "ABC"w is a UTF16 string
Literal "ABC"d is a UTF32 string

C:\dmd>

David L.

-------------------------------------------------------------------
"Dare to reach for the Stars...Dare to Dream, Build, and Achieve!"
-------------------------------------------------------------------

MKoD: http://spottedtiger.tripod.com/D_Language/D_Main_XP.html
August 07, 2005
"David L. Davis" <SpottedTiger@yahoo.com> wrote in message news:dd515n$97m$1@digitaldaemon.com...
> Walter, thanks for adding the string literal indicators, though I thought
> they
> would've have been prefixes instead of postfixes, because of the many
> posts on
> the subject back in the days when Jill and others (myself included)
> requested
> something like this. But hey, it works, and I'm not about to "kick a gift
> horse
> in the mouth!" :)

I'm also a little surprised that they're postfixes instead of prefixes, since D already has the r and x prefixes.  c, w, and d as prefixes would be a little more consistent, and would maybe even make more sense to those coming from C++ that has the L prefix.

I like them, though.


August 07, 2005
> I'm also a little surprised that they're postfixes instead of prefixes,
> since D already has the r and x prefixes.  c, w, and d as prefixes would be
> a little more consistent, and would maybe even make more sense to those
> coming from C++ that has the L prefix.

How to denote a WYSIWYG UTF-16 string, then? rw"This way???" That makes no sense, eh? And the number modifiers are postfixes, too (234u, 23.54l etc.).

Ciao
uwe
August 07, 2005
"Jarrett Billingsley" <kb3ctd2@yahoo.com> wrote in message news:dd5gpa$kt2$1@digitaldaemon.com...
> "David L. Davis" <SpottedTiger@yahoo.com> wrote in message news:dd515n$97m$1@digitaldaemon.com...
>> Walter, thanks for adding the string literal indicators, though I thought
>> they
>> would've have been prefixes instead of postfixes, because of the many
>> posts on
>> the subject back in the days when Jill and others (myself included)
>> requested
>> something like this. But hey, it works, and I'm not about to "kick a gift
>> horse
>> in the mouth!" :)
>
> I'm also a little surprised that they're postfixes instead of prefixes, since D already has the r and x prefixes.  c, w, and d as prefixes would be a little more consistent, and would maybe even make more sense to those coming from C++ that has the L prefix.
>
> I like them, though.

Postfix makes it easier to parse since you don't have to look for cr", rc" permutations. The r/x are mutually exclusive and the c/w/d are mutually exclusive so it works out. Hopefully we won't need any more flags on string literals or else we'll have to get really creative.


August 08, 2005
"Jarrett Billingsley" <kb3ctd2@yahoo.com> wrote in message news:dd5gpa$kt2$1@digitaldaemon.com...
> I'm also a little surprised that they're postfixes instead of prefixes, since D already has the r and x prefixes.  c, w, and d as prefixes would
be
> a little more consistent, and would maybe even make more sense to those coming from C++ that has the L prefix.

Postfixes because:
1) consistent with numeric postfixes l, u, f, i, to specify type.
2) the string prefixes don't specify type, they specify in what format the
string will be