This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


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

Re: why can I pass doubles to "abs"?


Jennifer Frazier Bryan wrote:
> 
> Hi.  I'm using gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2
> release) from the RedHat 6.1 distribution.  I cannot get gcc to complain
> when double arguments are passed to "abs".  I am including <stdlib.h>,
> I've tried "#undef abs" and "(abs)" to force a function instead of a
> macro.  I've also set every -W flag that seems remotely relevant.  No
> warnings, no errors -- although it does complain when I do something
> really outrageous, like pass a function pointer to "abs". Please tell me
> where I'm going wrong.
> 
> a) Is it stupid or naive to want a warning when I pass a double argument
> to "abs" (e.g. I obviously menat to use "fabs")?
> 

This is not a normal warning.  There is a warning that checks for these
sorts of things: -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...

> b) Am I failing to tell gcc that I want that kind of a warning?
> 

Yep.

-eric


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