Re: geninit.c generares code that stresses gcc

Alex Cherepanov <[email protected]>
Newsgroups gmane.comp.printing.ghostscript.patches
Organization Coscript Software
Message-ID <[email protected]>
Igor V. Melichev wrote:

> I'm not sure that I have a time for testing this stuff,
> so please explain better, what happens in there.
Old version generates the string like:

const char s[]={'a', 'b', 'c'};

New version generates the string

const char s[]={"\
a\
bc"};

when it is compiled by GCC. Old format is generated
on other compilers.

With the recent addition of PS resources, compiled initialization
files make about 2 M. Compiling the old initializer, GCC needs
more than 128M of memory and fails on my system. With the likely
addition of other PS resources, the virtual memory will be
used up even on mid-range systems.

New code compiles instantly and takes little memory.

> Is this done uncoditionally,
> or there is an option for choosing the output style ?

Currently, the string is generated when geninit.c was compiled
by GCC and the list otherwise. This doesn't look right
but moving the format selection to autoconf requires patching
a dosen of makefiles. I'd prefer to do it only if the proposed
change is approved in principle.

> I don't know, why the old code generates lists.
> This to be asked from Raph or Ray.
Many compilers imcluding Visual C won't work with 2M strings.
gs_init.c(105) : error C2026: string too big, trailing characters truncated
So VC has about 4K limit on the string size.

Regards,
Alex
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.