[ECOS] Re: casts to a type other than an integral or enumeration type in a constant-expression

Jonathan Larmour jifl@eCosCentric.com
Thu Feb 13 13:44:00 GMT 2003


Andreas Schwab wrote:
> Jonathan Larmour <jifl@eCosCentric.com> writes:
> 
> |> Nathan Sidwell wrote:
> |> > the problem is SIG_DFL is probably,
> |> >     typedef void (*__sighandler_t) (int);
> |> >     #define SIG_DFL ((__sighandler_t)0)
> |> 
> |> Indeed it's like that. But the whole thing is cast to an int, so the
> |> expression as a whole has integral type. From the C++ standard 6.4.2 para
> |> 2 that's all that's required, the way I read it. Having a non-integral
> |> type in an intermediate stage should make no difference.
> 
> But 5.19[#1] also says about integral constant expressions: "Only type
> conversions to integral or enumeration types can be used.".  A function
> cast is not valid according to this clause.

Ah ok. That goes on to say that functions, pointers etc. cannot be "used" 
which is stronger than just being the result of evaluation.

A good thing I changed the code anyway then :-). Fred, thanks for letting 
us know about it.

Jifl
-- 
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
--[ "You can complain because roses have thorns, or you ]--
--[  can rejoice because thorns have roses." -Lincoln   ]-- Opinions==mine


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss



More information about the Ecos-discuss mailing list