Re: mixed mode allowed for comparison macros?
- From: "Robert Gamble" <rgamble99@xxxxxxxxx>
- Date: 23 Jan 2006 21:16:42 -0800
Howard Hinnant wrote:
> In article <1138046748.075526.25410@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
> "Robert Gamble" <rgamble99@xxxxxxxxx> wrote:
>
> > Howard Hinnant wrote:
> > > Is this legal C99?
> > >
> > > #include <math.h>
> > >
> > > int main()
> > > {
> > > float x = 1;
> > > double y = 2;
> > > int b = isgreater(x, y);
> > > }
> >
> > I don't see any reason it wouldn't be, why do you think it might not
> > be?
>
> The standard says:
>
> int isgreater(real-floating x,real-floating y);
>
> To me it is not clear if the two real-floating parameters can have
> different types or not.
>
> Furthermore I have empirical evidence that prominent C committee members
> *might* believe the two parameters should be constrained to the same
> type. From the language in the standard I'm unable to form a firm
> argument for either position.
>
> Why do you think it might be allowed?
I haven't seen this evidence you speak of but from your description it
doesn't sound very persuasive. There are two reasons that I think
mixed types are allowed. First, it would be quite an oversight to
forget to mention that "oh, by the way, this is only defined if x and y
are of the same type" especially when the wording is so otherwise
thorough in that section. The term "real floating-point" is used
several times to describe the type of arguments the macros operate on,
I think that if there were further restrictions it would be easy enough
to say so.
Second, the whole point of the macros is to be able to perform
non-exceptional comparision on real floating-point types. The scope of
the macros would be quite limited is the restriction you suggest were
intended.
kuyper also makes a good case in his response.
Robert Gamble
.
- References:
- mixed mode allowed for comparison macros?
- From: Howard Hinnant
- Re: mixed mode allowed for comparison macros?
- From: Robert Gamble
- Re: mixed mode allowed for comparison macros?
- From: Howard Hinnant
- mixed mode allowed for comparison macros?
- Prev by Date: Re: mixed mode allowed for comparison macros?
- Next by Date: Is tab[x++] = val undefined?
- Previous by thread: Re: mixed mode allowed for comparison macros?
- Next by thread: Re: mixed mode allowed for comparison macros?
- Index(es):
Relevant Pages
|
|