Is implicit string literal concatenation a good thing?

Christopher Wright dhasenan at gmail.com
Sun Feb 22 05:50:51 PST 2009


Brad Roberts wrote:
> Back in c and c++, with it's pre-processor, merging adjacent string
> literals is very handy.  In D, it's only marginally so, but not
> completely useless.  It can still be used to break a really long string
> literal into parts.  There's other string boundary tokens in D which
> might well provide viable alternatives.

In C and C++, there is no way to catenate strings at compile time. The 
only way to catenate strings is with strcat. That places the additional 
burden on programmers that they have to include string.h. For that 
reason, it makes sense to catenate adjacent string literals.

In D, there's a compile time catenation operator that doesn't require 
libraries. So the catenation by association saves you only one 
character. I'd say that's useless.



More information about the Digitalmars-d mailing list