Is implicit string literal concatenation a good thing?

Denis Koroskin 2korden at gmail.com
Sun Feb 22 06:12:11 PST 2009


On Sun, 22 Feb 2009 16:50:51 +0300, Christopher Wright <dhasenan at gmail.com> wrote:

> 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.

I agree.




More information about the Digitalmars-d mailing list