endsWith: wrong function call, no error

David Nadlinger code at klickverbot.at
Mon Oct 21 08:57:12 PDT 2013


On Monday, 21 October 2013 at 15:38:47 UTC, David Eagen wrote:
> I actually like that feature. It's me compose long strings in 
> an easily viewable way without having to use concatenation and 
> therefore additional allocation.

Concatenation of string literals doesn't need to allocate, as 
discussed here: 
http://d.puremagic.com/issues/show_bug.cgi?id=3827. It's trivial 
to handle the cases where you would've written "string1" 
"string2" instead of "string1" ~ "string2". Once overloaded 
operators come into play, it's a bit trickier, but if this case 
really occurred in your program, you could always add a pair of 
parens to fix it.

See also this post by Walter: 
http://forum.dlang.org/post/ibi742$gi2$1@digitalmars.com

David


More information about the Digitalmars-d mailing list