[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: What is the preferred way to embed multi-line string in C source?
- From: MFarm <farmbuyer@...>
- Date: Fri, 19 Dec 2008 13:29:08 -0500
On Fri, Dec 19, 2008 at 12:38 PM, Jeff Pohlmeyer
> On Fri, Dec 19, 2008 at 10:53 AM, David Jones <firstname.lastname@example.org> wrote:
>> The portable limit on the total length of the string as specified in
>> the standard is 4095 characters (in C99). If you are generating C code
>> with a program you can easily go past this.
> There is a note in the libcurl sources:
> "gcc 2.96 claims ISO C89 only is required to support 509 letter strings"
> I'm not sure how accurate that is, so please don't shoot the messenger :-)
It sounds about right. But C89 is, after all, almost 20 years old.
Being constrained by small memory environments is one thing, but
arbitrary limits older than some of the programmers writing in Lua are
another thing entirely. :-) I would expect that any decent modern
C99 compiler should be able to handle much larger strings.
> But I guess you could even break the code up into smaller chunks
> and re-assemble it at runtime...
Good thought. Maybe an array of such strings, each limited to 4K?
Writing a small Lua program to read in text (say, Lua source) and spit
out such a C array would be a good exercise, I might go play with