[Tfug] C Compiler string limitations?
TR
trexx at pobox.com
Mon Jul 17 13:00:16 MST 2006
Bexley Hall wrote:
>Hi,
>
>I'm curious if anyone has had any experiences with
>compilers choking on long strings/byte arrays.
>
>I have some data structures that look like:
>
>"..." ## "..." ## "..." (etc)
>
>
How is
"..." ## "..." ## "..."
any different then
"..." "..." "..."
or for that matter
"........."
I realize that the data may be 'generated' for you but the the ANSI Token Pasting should not be the way to concatenate stings. Two strings adjacent is all that is needed .
The Token Pasting feature is to allows concatenation within MACROs like
#define FILE_NAME( ext ) test.##ext
So that
fopen( FILE_NAME( bak ) ) ;
becomes
fopen( test.bak ) ;
>and, in the interest of portability, would hope that
>few compilers would gag on them.
>
>
Using the Token pasting operator could be non portable.
>I can, alternatively, rewuite them as char[] but
>that's a bit more processing in my scripts
>(the structures are built automatically).
>
>
I would build the string what ever is the easiest way and save to a
file. Then write a function to read and parse that file to capture the
strings. Now the string is not ever seen by the compiler. And only
used at runtime.
>I know GCC uses a crapload of VM when processing
>large arrays but, with enough swap, that's not
>an issue. I'm just wondering if other toolchains
>simply crash-and-burn in these cases...
>
>Thanks!
>--don
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam? Yahoo! Mail has the best spam protection around
>http://mail.yahoo.com
>
>_______________________________________________
>Tucson Free Unix Group - tfug at tfug.org
>Subscription Options:
>http://www.tfug.org/mailman/listinfo/tfug_tfug.org
>
>
>
>
More information about the tfug
mailing list