Here's a sneaky little bug

Kagamin spam at here.lot
Fri Jun 24 12:46:01 PDT 2011


Andrej Mitrovic Wrote:

> import std.stdio;
> 
> void main()
> {
>     bool state = false;
>     writeln("state is: " ~ state ? "true" : "false");
> }

lol, if you don't know how an operator works, don't use in bigger expressions. You have local variables, right? It's also a bad practice to assemble messages from parts. Such code is non-localizable.

writefln(gettext("state is: %s"), gettext(state ? "true" : "false"));
vs
writeln(gettext(state ? "state is: true" : "state is: false"));

the former assumes english language word ordering.
Concat also involves heap activity.


More information about the Digitalmars-d mailing list