D
David Mathog
I'm looking at a program which stores perl scripts in an array. Each
script is stored as a single entry in that array, and the whole set of
them live in a single header file (escaped out the wazoo to get the
perl code intact through the C preprocessor.) The issue is that
many of these strings are quite long, which causes gcc to throw
these sorts of warnings:
scripts.h:1: warning: string length '4918' is greater than the length
'4095' ISO C99 compilers are required to support
Luckily gcc supports (much) longer strings so the warnings are just
warnings. However this makes me wonder if there isn't some clever
preprocessor trick that is standards compliant to get past this limit?
For instance, could several shorter strings be combined somehow into a
single longer string within the header file, or must the longer
string be constructed at run time to safely avoid this warning?
That is, is this string length limit for any const char * no matter
how it is put together, or is it just a limitation that applies to
statements like:
astring = "......(many characters)...";
where the limitation is on the right side of the expression?
Thanks,
David Mathog
script is stored as a single entry in that array, and the whole set of
them live in a single header file (escaped out the wazoo to get the
perl code intact through the C preprocessor.) The issue is that
many of these strings are quite long, which causes gcc to throw
these sorts of warnings:
scripts.h:1: warning: string length '4918' is greater than the length
'4095' ISO C99 compilers are required to support
Luckily gcc supports (much) longer strings so the warnings are just
warnings. However this makes me wonder if there isn't some clever
preprocessor trick that is standards compliant to get past this limit?
For instance, could several shorter strings be combined somehow into a
single longer string within the header file, or must the longer
string be constructed at run time to safely avoid this warning?
That is, is this string length limit for any const char * no matter
how it is put together, or is it just a limitation that applies to
statements like:
astring = "......(many characters)...";
where the limitation is on the right side of the expression?
Thanks,
David Mathog