Re: Parameter Name Warning?

From: Victor Bazarov (v.Abazarov_at_comAcast.net)
Date: 04/13/04


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



Relevant Pages

  • Re: Parameter Name Warning?
    ... I'm comparing them because they are both equally legal statements in the eyes of C++ and have side effects that can be considered ... Yet you ridicule the fact that a warning is provided for one, ... >> use the exact same types in numerical expressions either. ...
    (microsoft.public.vc.language)
  • Re: Learning C with Older books ?.
    ... It's nice to see that the comments about the signed/unsigned warning ... Your regular compilation environment must be different from mine. ... The 'usually useful' are those that are on by default in production ... the style choice to add redundant parentheses in certain ...
    (comp.lang.c)
  • Re: Learning C with Older books ?.
    ... It's nice to see that the comments about the signed/unsigned warning ... Your regular compilation environment must be different from mine. ... The 'usually useful' are those that are on by default in production ... the style choice to add redundant parentheses in certain ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Inconsistent Program Results
    ... including one of them might trivially slow down compilation, ... I wrote the above (starting with "The standard headers"). ... return void, but there's no advantage in using that. ... You're cheating yourself by ignoring warning messages. ...
    (comp.lang.c)
  • Re: Java Compilation on 6.0
    ... and then, as root, execute the commands: ... a couple more hours of compilation. ...
    (comp.unix.bsd.freebsd.misc)