member function with no class name specified

Discussion in 'C++' started by jackgoche@googlemail.com, Nov 16, 2006.

  1. Guest

    Hello,

    I have come across the following directive but I don't see a class
    name specified in front of the ::Check function. Does anyone
    know what this means and how the directive is supposed to work?

    #define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__)

    Thanks,

    JG
     
    , Nov 16, 2006
    #1
    1. Advertising

  2. Rolf Magnus Guest

    wrote:

    > Hello,
    >
    > I have come across the following directive but I don't see a class
    > name specified in front of the ::Check function. Does anyone know what
    > this means


    It refers to the Check function in the global namespace. So even if the

    > and how the directive is supposed to work?
    >
    > #define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__)


    You can call it from any namespace or any class, and even if that namespace
    or class has a Check function of its own, the one in the gobal namespace
    will be called.
     
    Rolf Magnus, Nov 16, 2006
    #2
    1. Advertising

  3. Rolf Magnus wrote:
    > wrote:
    >
    >> Hello,
    >>
    >> I have come across the following directive but I don't see a class
    >> name specified in front of the ::Check function. Does anyone know
    >> what this means

    >
    > It refers to the Check function in the global namespace. So even if
    > the
    >
    >> and how the directive is supposed to work?
    >>
    >> #define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__)

    >
    > You can call it from any namespace or any class, and even if that
    > namespace or class has a Check function of its own, the one in the
    > gobal namespace will be called.


    Unless some bloke prepends the macro with the class name for whatever
    reason:

    SomeClassThatHasCheckMember TEST2(blah, BLAH);

    :)

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
     
    Victor Bazarov, Nov 16, 2006
    #3
    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. E11
    Replies:
    1
    Views:
    4,788
    Thomas Weidenfeller
    Oct 12, 2005
  2. Replies:
    12
    Views:
    726
    fluden
    Feb 11, 2005
  3. John Goche
    Replies:
    3
    Views:
    279
    Victor Bazarov
    Nov 16, 2006
  4. Praetorian
    Replies:
    11
    Views:
    2,355
    James Kanze
    Apr 3, 2008
  5. Peng Yu
    Replies:
    2
    Views:
    373
Loading...

Share This Page