Thread: Strange response from MSVC

  1. #1
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607

    Strange response from MSVC

    This is strange. I was creating a class and putting a function declaration in it called bool AddFrame(). MSVC pops up a help window telling me what belongs in the parameter list. However, this function is part of my class. Why is MSVC thinking this function is part of another declaration?? They should be, according the rules of C++, two separate distinct functions.

    Strange.

    Code:
    class A
    {
      public:
          A() {};
          ~A() {};
          void SomeFunc();
    };
    
    class B
    {
      public:
          B() {};
          ~B() {};
          void SomeFunc();
    };
    The SomeFunc() function has the same name but it is not the same function - it is relative to the class is it not?? SomeFunc() can have the same name in as many classes as it wants - they are in different objects.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Is it the same name as some existing M$ API ?

    Did you add class A, do a build, then add class B ?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    No it seems that the MSVC IDE will give you the prototype for all existing Windows API functions no matter if you are coding the function with the same name as the API inside of a class. For some reason the IDE does not differentiate between the API function and the one you are creating. I've not encountered this with any other classes or functions. Try it. Create a class and then make a function called CreateWindow. The CreateWindow from the API will show up in the help window even though you are redefining it relative to your class. This seems odd because there is no danger of namespace clashes since you are declaring the function inside of a class. I'm not sure why MSVC does this.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sorting out cause of wrong response from class members
    By imCrushedByCode in forum C++ Programming
    Replies: 11
    Last Post: 04-18-2006, 12:30 AM
  2. Strange warning from MSVC 6
    By VirtualAce in forum Game Programming
    Replies: 7
    Last Post: 03-27-2006, 10:55 AM
  3. MSVC behaves strange
    By ripper079 in forum C++ Programming
    Replies: 4
    Last Post: 10-28-2003, 08:34 PM
  4. Strange MSVC winsock2 compile error
    By LuckY in forum Windows Programming
    Replies: 3
    Last Post: 06-28-2003, 08:18 AM
  5. Array, reading in response etc...
    By mattz in forum C Programming
    Replies: 4
    Last Post: 12-05-2001, 11:41 AM