Re: [gtk-list] Re: compiling gtk+ on solaris



Erik Mouw wrote:
> On Wed, 22 Dec 1999 19:26:59 +0100, Drazen Kacar wrote:

> > I think I've reported it about a month ago. The include files are taken
> > directly from X/Open distribution and Sun is reluctant to change anything.
> 
> If that's true, those X/Open guys really have a strange ideas how portable
> code should look like. Looking at X11/Xlib.h on a SGI O2 running IRIX 6.3
> I see fully prototyped functions (for example XDoesBackingStore()):
> 
>   extern int XDoesBackingStore(
>   #if NeedFunctionPrototypes
>       Screen*             /* screen */    
>   #endif
>   );
> 
> Which is the same on a SuSE Linux 6.1 and a Debian 2.1 box. Does this mean
> that SGI and XFree86 add ANSI compliant prototypes to each function, or
> that Sun *removes* the prototypes?

I think Sun didn't touch them. I suppose other vendors added the missing
declarations, which is what one would expect for OS's where gcc is the
only compiler, at least. I didn't check the original X distribution, so I
might be wrong.

XDoesBackingStore() is declared as extern int on Solaris, too. It's not that
all such functions don't have return value declared. Only some of
them. Maybe they should really be void and not int. OTOH, there are
some which are explicitely declared as such. It's weird.

Here are some not explicitely declared:

extern XActivateScreenSaver(
#if NeedFunctionPrototypes
    Display*            /* display */
#endif
);

extern XAddHost(
#if NeedFunctionPrototypes
    Display*            /* display */,
    XHostAddress*       /* host */
#endif
);

Man pages also doesn't have more information about the type returned. I think
these should be void, but I'm not 100% sure.

> > Although it's annoying when gcc compiles C program, it's not a real
> > problem. But g++ (new versions) will refuse to compile those files.
> 
> And for valid reasons. The gcc team worked towards a *correct* C/C++
> compiler implementation. Sometimes this means that previously assumed
> correct C constructions fail with gcc 2.95.2, but my experience is that
> all "sane coded" programs pass gcc 2.95.2 with no or little changes.

Sun's C compiler doesn't warn in this case. I haven't tried with their
C++ compiler, though.

> I can't decide which is worse: Sun changing the include files or X/Open
> *not* adding proper prototypes.

Tough decision, I agree. :-)

-- 
 .-.   .-.    I don't work for my employer.
(_  \ /  _)
     |        dave@srce.hr
     |        dave@fly.srk.fer.hr



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