[SciPy-dev] mtrand.c compiler warnings

Pearu Peterson pearu at scipy.org
Thu Oct 13 09:43:07 CDT 2005

On Thu, 13 Oct 2005, Robert Kern wrote:

> Pearu Peterson wrote:
>> Hi Robert,
>> Compiling mtrand.c throws lots of compiler warnings. Is it safe to
>> handedit mtrand.c to fix these warnings? Or should pyrex fixed to get rid
>> of these warnings?
> No, it's not safe to hand-edit mtrand.c . It really shouldn't even be in
> the repository, but I didn't want to make Pyrex an explicit
> build-dependency.

Ok, that's what I also thought.

> Pyrex *ought* to be fixed to get rid of these warnings, but no one has
> really done the leg work to do so. None of the warnings actually matter,
> though. Does the distutils compiler abstraction easily allow silencing
> warnings? With gcc, you can just add -w, but people may not be using gcc.

I don't believe that silencing warnings is a good practice, they should 
be fixed, in general. If we were using all the same compiler, then it 
might be safe to ignore warnings but considering on how many different 
platforms and with different compilers scipy should be buildable, it is 
safer to fix these warnings rather than hide them. Warnings like
'warning: assignment from incompatible pointer type' are particularly 
dangerous and such warnings often indicate the location of bugs, some 
compilers may handle them 'well' while others may not. Even warnings like 
'unused variables' may indicate typos.

Sure, mtrand.c is a generated code and then warnings on 'unused variables' 
are often safe to ignore. However, shutting down all warnings for one 
extension is dangerous to others, especially for handwritten ones.


More information about the Scipy-dev mailing list