Re: null vs undefined

Discussion in 'C++' started by Victor Bazarov, Aug 19, 2003.

  1. "Web Developer" <> wrote...
    > Whats the difference from null and undefined in C++ as opposed to Java.


    What's "undefined" in your sentence? 'null' has only one meaning
    in C++ -- it's part of the concept of "null pointer value". That
    concept defines a value of a pointer that [in C++ virtual machine]
    doesn't represent any object (or function). 'Undefined' is just
    that, has no particular definition (whether it's about a value or
    behaviour). If you are asking specifically about pointers, then
    pointers have undefined values when they are uninitialised. They
    have "null pointer value" when you initialise them to be that:

    sometype *pointer = 0;

    (conversion from an integral expression that evaluates to (int)0
    to a pointer to object yields the "null pointer value").

    Victor
     
    Victor Bazarov, Aug 19, 2003
    #1
    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. Replies:
    5
    Views:
    27,507
    Mike Schilling
    Mar 29, 2006
  2. Mantorok Redgormor
    Replies:
    70
    Views:
    1,843
    Dan Pop
    Feb 17, 2004
  3. Don Vaillancourt

    First "undefined" then null and now "null"

    Don Vaillancourt, Oct 27, 2004, in forum: Javascript
    Replies:
    13
    Views:
    230
    Thomas 'PointedEars' Lahn
    Dec 11, 2004
  4. VK
    Replies:
    45
    Views:
    665
    Dr John Stockton
    Sep 12, 2006
  5. -Lost
    Replies:
    13
    Views:
    390
    Richard Cornford
    Jan 31, 2007
Loading...

Share This Page