lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, Dec 19, 2008 at 12:38 PM, Jeff Pohlmeyer
<yetanothergeek@gmail.com> wrote:
> On Fri, Dec 19, 2008 at 10:53 AM, David Jones <drj@pobox.com> 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:
>  http://curl.haxx.se/lxr/source/src/mkhelp.pl#L213
>
> "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
that.