Thread: 'NULL' undeclared (first use this function)

  1. #31
    Registered User
    Join Date
    Oct 2001
    >I see your point swoopy but you know what I meant. Sorry if I didn't elaborate enough.
    Well, Bjarne Stroustrup indeed prefers 0. I've always liked NULL, so I can tell the variable is a pointer immediately. But I guess nullptr will soon be here, so the point will then be moot.

  2. #32
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    In everything else
    Actually, NULL is defined in <cstddef>, so we might as well include that standard header instead of defining NULL ourselves.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #33
    Join Date
    Oct 2007
    Inside my computer
    Quote Originally Posted by lruc View Post
    0 is c++:NULL is c.
    It's as simple as that.
    Is not.
    NULL exists in both C and C++. What it is defined as is irrelevant.
    The purpose of NULL hasn't changed in C++.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. In over my head
    By Shelnutt2 in forum C Programming
    Replies: 1
    Last Post: 07-08-2008, 06:54 PM
  2. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM
  3. C++ compilation issues
    By Rupan in forum C++ Programming
    Replies: 1
    Last Post: 08-22-2005, 05:45 AM
  4. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM