CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12

Threaded View

  1. #11
    Join Date
    Jan 2009
    Posts
    1,689

    Re: [c++] typedef class

    The function is also used, but never defined.

    Remember that
    Code:
    class foo {
       void DoSomething(void);
    };
    
    void foo::DoSomething(void){
       std::cout << "Hello World" << std::endl;
    }
    
    foo * bar;
    
    main(){
       bar -> DoSomething();
    }
    Is undefined behavior, but stable on almost every compiler.

    Also, why do statically declared pointers initialize to zero? Seems like a waste of a mov command to me. I always do this
    Code:
    foo * bar = 0;
    If I want to know if the pointer has been initialized or not later. If I omit the zero, I don't care what it is.
    Last edited by ninja9578; February 22nd, 2010 at 09:07 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured