[cairo] Re : internal cairo include syntax seems not flexible enough, backward-compatible fix proposal.

Fabien Costantini fab672000 at yahoo.fr
Wed Sep 24 01:22:53 PDT 2008


Carl wrote:

On Sat, 2008-09-20 at 07:56 +0000, Fabien Costantini wrote:
>> I was willing to include cairo include files using the cairo directory as follow:
>>     #include <cairo/cairo.h>
>> instead of
>>     #include <cairo.h>
>>
>> This way,  I don't need to add a specific include directory statement in makefiles like -I /usr/local/include/cairo ,
>> provided that cairo is installed in common include directories.

>Hi Fabien,
>Thanks for raising this issue.
Thanks for discussing it constructively and nicely ;-)

>Here are some problems with application code using <cairo/cairo.h>:
>1. It's ugly. Worse than being more typing---it's a name with redundant
>components in it, and that's just not pleasant.
libpng that cairo uses just does that, as do many other libs.
I guess an important point is : you're not forced to do that,
cairo documentation could just say something like:
we support the <cairo/cairo-xxxx.h> but we recommend using <cairo-xxx.h>,
blabla ...

>2. It's different. If some people use <cairo.h> and others use
><cairo/cairo.h> then there's potential confusion. If people share code
>casually, (without corresponding build scripts), then the code might not
>work
from one evironment to the next. Not nice. Users might see other form
and wonder if they're doing >something "wrong". Again, more
>confusion and an isse better to just avoid.
Again, this could be documented as side effects, 
just as you read the documentation of a medicine tablet.
And how do the other libs that  use this construction successfully then, 
should be our questionning too.

>3. It breaks our standard build instructions. The documented approach is
>to use pkg-config to get the correct build flags. But if pkg-config is
>giving you -I/some/prefix/cairo and you use <cairo/cairo.h> then you
>won't get the header you want from /some/prefix/cairo, but could
>silently get an incorrect one from /usr/include/cairo. That's very bad.
I guess many muti-platform oriented teams would think that forcing
a pkg-config dependency in their build files is indeed very bad.

>So we definitely want to teach people to just use <cairo.h>. 
Open source for me rimes with open minded, 
I believe that one could recommend one include construction,
but not force it.

Furthermore, as you already include libs that do use this construction,
it would be more orthogonal for cairo sources IMHO.

Finally, I would like to emphasize the fact that both constructions are possible
with such modification, and that you can recommend things,
but as behdah said with humor, let people have the freedom to shoot them on the foot,
if they want it,  in our fields ; we often cope for best compromises,
no alternative/solution is perfect most of the time,
that's why it's so important IMHO to let users having options.

Thanks very much for your feedback Carl,
and yes we do have fun with Cairo and would like to promote it 
outside gtk while keeping some minimum integration freedom :-)

Fabien


More information about the cairo mailing list