libX11: fixing public headers?

Brian Paul brian.paul at tungstengraphics.com
Mon Apr 2 07:49:19 PDT 2007


Keith Packard wrote:
> On Sun, 2007-04-01 at 11:50 +0200, Tilman Sauerbeck wrote:
> 
>> What does everyone think about adding "const" there?
> 
> C programs may end up generating extra warnings, but C++ programs may
> start to fail to compile.
> 
>> Can/should we do that?
> 
> I guess the question is what bugs we expect to uncover by eliciting
> additional compiler warnings and errors. If we expect these are being
> mis-used, it would be a good thing. However, if we just end up breaking
> a lot of otherwise correct code, it doesn't seem like a good plan.

I think adding const qualifiers to function parameters is generally 
safe.  But adding a const qualifier to a returned pointer might cause 
problems, as Keith alluded to.

I'm big on const-correctness.  Every once in a while it really saves 
your skin.

-Brian



More information about the xorg mailing list