warn/croak on "string" "string" auto-joins

Stan Shebs shebs@apple.com
Tue Aug 17 23:25:00 GMT 2004


Robert Dewar wrote:

> Zack Weinberg wrote:
>
>> Adam Monsen <haircut@gmail.com> writes:
>>
>>
>>> String auto-joins can be dangerous. Is there a way to tell the
>>> compiler to warn/croak when an auto-join occurs?
>>
>>
>>
>> There is not, and without a way for the programmer to make clear that
>> a given use of string-constant concatenation is intentional, I am
>> reluctant to add one.
>
>
> I would think the reasonable condition for the warning is that no
> line feed appears between the two strings, which is indeed unusual
> usage.

Not that unusual, for instance consider a macro that expands into
"%d" or "%ld", used in printf("before " MACRO " after", int_or_long)
and the like. Our very own code uses this trick even.

Stan



More information about the Gcc mailing list