variable shadow

Discussion in 'C++' started by Black Ice, Aug 9, 2003.

  1. Black Ice

    Black Ice Guest

    If any compiler will give warning when meed variable show.
    Following is the example code:
    void foo()
    {
    int total;
    if(...)
    {
    int total;
    ...
    }
    }


    --


    Regards,
    Black Ice

    Çë²»Òª»Ø¸´µ½ÎÒµÄÓÊÏä

    ×ÔÓÉ£¨liberty£©Î޷ǾÍÊÇÕâÑùÒ»ÖÖ³Ðŵ£ºÃ¿¸öÈ˽«»áµÃµ½Ò»ÖÖ±£ÕÏ£¬±£ÕÏÎÒÃÇ¿ÉÒÔÓë
    ȨÍþ¡¢¶àÊý¡¢Á÷Ë×¼°ÓßÂÛµÄÓ°ÏìÏ࿹ºâ¡£

    http://www.leoliu.net
    Black Ice, Aug 9, 2003
    #1
    1. Advertising

  2. "Black Ice" <> wrote...
    > If any compiler will give warning when meed variable show.


    I am not sure I understand that sentence. 'Meed' is a noun. Used
    with another noun ('variable') it becomes an attribute. "Meed
    variable" is "earned reward variable"?... I don't understand.

    > Following is the example code:
    > void foo()
    > {
    > int total;
    > if(...)
    > {
    > int total;
    > ...
    > }
    > }


    No, in most cases no warning will be given. Name hiding (that's
    the C++ term) is a legal C++ construct and used often.

    Victor
    Victor Bazarov, Aug 9, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex

    Shadow copying

    Alex, Aug 8, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    485
  2. Bill Joyce

    COM+ error when I do a Shadow copy

    Bill Joyce, Sep 23, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    434
    Bill Joyce
    Sep 23, 2004
  3. =?Utf-8?B?SUNFIFNybA==?=

    ASP.Net 1.1 shadow copy problem

    =?Utf-8?B?SUNFIFNybA==?=, Nov 26, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    1,709
    =?Utf-8?B?aWNlc29mdHdhcmU=?=
    Nov 26, 2004
  4. Barry Kelly
    Replies:
    4
    Views:
    4,678
    Barry Kelly
    Dec 7, 2004
  5. Kevin Frey
    Replies:
    0
    Views:
    545
    Kevin Frey
    Oct 20, 2005
Loading...

Share This Page