[ECOS] Re: casts to a type other than an integral or enumeration type in a constant-expression
Nathan Sidwell
nathan@codesourcery.com
Thu Feb 13 12:48:00 GMT 2003
Jonathan Larmour wrote:
>> |> case (int) SIG_DFL:
>>
>> This code is completely bogus anyway, even if it might be valid. Casting
>> a pointer to int is dubious at best and will fail miserably if sizeof
>> (__sighandler_t) > sizeof (int).
>
>
> Assuming I'm thinking of the right bit of code, Fred was paraphrasing
> the code. The "int" is actually an eCos typedef set by the hardware
> abstraction layer so _will_ be correct for the hardware.
>
> The warning is certainly misleading at best as an int is certainly an
> integral type ;-). From a quick read of the C++ standard, I can't see
> any problem with this code.
the problem is SIG_DFL is probably,
typedef void (*__sighandler_t) (int);
#define SIG_DFL ((__sighandler_t)0)
> I will change the eCos code to use if/else instead because I'd rather it
> was compatible with the release of gcc since that isn't going to start
> working for a while. But you gcc folks can fix the problem anyway :-).
not a g++ problem :)
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
The voices in my head said this was stupid too
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
More information about the Gcc-bugs
mailing list