This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gsl and gcc -Wconversion


 > Jerome BENOIT [Tue, 11 Jan 2005]:
 > Thanks for the quick reply.
 > 
 > Olivier Andrieu wrote:
 > >  > Jerome BENOIT [Tue, 11 Jan 2005]:
 > >  > Hello List,
 > >  > 
 > >  > recently I add compilation option as it is explained in the GSL Manual to build one of my stuff:
 > >  > I have noticed that the option -Wconversion (gcc) produces the warning message
 > >  > 
 > >  > warning: passing arg 4 of `gsl_matrix_char_set' with different width due to prototype
 > >  > 
 > >  > when the fourth is an expected (const char).
 > >  > 
 > >  > The attached program does reproduce this warning with different gcc compiler (gcc 2.95, gcc-3.[234])
 > >  > on my Debian (Sarge) Pentium 4M box (i686).
 > >  > 
 > >  > Does I miss something ?
 > > 
 > > Character constants (in simple quotes, like 'A') are of type int in C.
 > 
 > Indeed !
 > 
 > But what about ((const char)(1)) ?
 > 
 > Otherwise, is there a work around (I would like to use the option -Werror) ?

Sorry, I replied too quickly and didn't look at the documentation of
-Wconversion:
,----
| `-Wconversion'
|      Warn if a prototype causes a type conversion that is different
|      from what would happen to the same argument in the absence of a
|      prototype.  This includes conversions of fixed point to floating
|      and vice versa, and conversions changing the width or signedness
|      of a fixed point argument except when the same as the default
|      promotion.
`----
For char arguments, the default promotion rule is to be converted to
int IIRC. So I guess this means you will always get a warning (?)

cf.
http://groups-beta.google.com/group/gnu.gcc.bug/msg/1e8545e6b7e03320

-- 
   Olivier


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]