Re: Parameter Name Warning?
From: Victor Bazarov (v.Abazarov_at_comAcast.net)
Date: 04/13/04
- Next message: Victor Bazarov: "Re: Parameter Name Warning?"
- Previous message: Victor Bazarov: "Re: Parameter Name Warning?"
- In reply to: Adam Clauss: "Re: Parameter Name Warning?"
- Next in thread: Adam Clauss: "Re: Parameter Name Warning?"
- Reply: Adam Clauss: "Re: Parameter Name Warning?"
- Reply: Michael Kennedy [UB]: "Re: Parameter Name Warning?"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 13 Apr 2004 15:45:36 -0400
Adam Clauss wrote:
> Just for clarification, Victor made that comment, not I. But I do agree with you on it. While as far as compilation is concerned
> the names on the declarations do not matter, it should perhaps give a warning regarding different names being used.
> The C++ standard may not require those names to be the same (or to exist in the declaration at all), but it does not require us to
> use the exact same types in numerical expressions either. And we get a warning for those:
> Ex:
> int x = 5;
> double y = 7.743;
> unsigned long z = x + y;
>
> That code is perfectly LEGAL, but we get a warning about it, as we probably should. We should also get a warning about parameter
> names being misnamed as well. Not an error for sure, but a warning would be worthwhile.
Hold on... In your example, data loss occurs. The fractional part of the
expression 'x+y' is discarded during initialization of 'z'. How can you
compare the two cases?
V
- Next message: Victor Bazarov: "Re: Parameter Name Warning?"
- Previous message: Victor Bazarov: "Re: Parameter Name Warning?"
- In reply to: Adam Clauss: "Re: Parameter Name Warning?"
- Next in thread: Adam Clauss: "Re: Parameter Name Warning?"
- Reply: Adam Clauss: "Re: Parameter Name Warning?"
- Reply: Michael Kennedy [UB]: "Re: Parameter Name Warning?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|