chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] [Chicken-users] Some questions about CHICKEN 5 egg


From: Thomas Chust
Subject: Re: [Chicken-hackers] [Chicken-users] Some questions about CHICKEN 5 eggs and modules
Date: Wed, 29 Aug 2018 12:20:35 +0200

On Wed, 29 Aug 2018 10:57:54 +0200 address@hidden wrote:

> > As far as I understand the question (probably not really), a simple way to
> > do this is to (foreign-declare "#include \"foo.c\"") and add foo.h to the
> > source-dependencies of the file (see for example the simple-sha1 and
> > simple-md5 eggs, they do this).  No need for any special handling.
> > 
> > Of course it means your C files get a lot larger, and you don't benefit
> > from reduced compilation times from separate compilation.
> 
> That's right, this will work in many cases. On the other hand, foo.c
> will be compiled in the environment that chicken.h defines, including
> all macro and type definitions, which may pollute what foo.c expects
> to be seen. "Reparing" the environment may range from difficult to 
> impossible should foo.c have name clashes with anything defined
> in chicken.h. Moreover, foo.c may need special compilation flags
> that are not compatible with CHICKEN-generated source code.
> [...]

Hello,

I would argue that mashing together C compilation units using
brute-force #include is almost never the right thing to do and will
rarely work correctly, for the reasons Felix pointed out, unless the
code has specifically been written to function in the environment
provided by the other header files. C is designed to use a number of
separate files to manage the global state of preprocessor and compiler!

Ciao,
Thomas


-- 
Intelligence may only be the second oldest profession in the world,
but it is more immoral and there are more amateurs practicing it than
the oldest one.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]