l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2001 Dec 30 17:07

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] String concatenation limit in C?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] String concatenation limit in C?

On Thu, Jul 12, 2001 at 10:25:50PM -0700, Mark K. Kim wrote:
> Hey gang!
> If you have a code like this in C:
>    printf(
>       "Hello, world #1\n"
>       "Hello, world #2\n"
>       "Hello, world #3\n"
>    );
> this eventually gets translated to (either by the compiler or the
> preprocessor, I'm not sure):
>    printf("Hello, world #1\nHello, world #2\nHello, world #3\n");
> My question is whether there is a limit to how many of these
> concatenations the compiler or the preprocessor will do, and whether there
> is a limit to the total length of the strings before the concatenation and
> after the concatenation.

No limits at all.  This is a good technique for breaking up strings,
and is fairly common among comp.lang.c regulars.  There is no limit to
the total length of the strings, except for whatever the
implementation's limit on objects in general is.

> Does anyone have the ANSI C document? :)  

I have the 'official' standard for the most recent version of C,
ISO/IEC 9899:1999, but there are no complete implementations of that
yet, unfortunately, though several compilers (including the new GCC
3.0 combined with glibc 2.2) implement a substantial subset.  Some
/really/ kewl features - I can't wait 'til they're commonplace, but I
daren't write C99 code until there are a number of fully conforming

But, of course, I can't legally give you that.  You can get a copy of
the last public draft, but be warned that there are a number of
significant differences.

I also have the last public draft of the version of C which is most
widely implemented at the moment, apparently including the 1995
revisions.  I haven't found any problems using that as a reference, so
it should be good.  I'd be glad to send that to you if you'd like.


LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Appahost Applications
For a significant contribution towards our projector, and a generous donation to allow us to continue meeting at the Davis Library.