'NULL' undeclared (first use this function)

This is a discussion on 'NULL' undeclared (first use this function) within the C++ Programming forums, part of the General Programming Boards category; >I see your point swoopy but you know what I meant. Sorry if I didn't elaborate enough. Well, Bjarne Stroustrup ...

  1. #31
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    >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
    Location
    Singapore
    Posts
    21,394
    In everything else
    Actually, NULL is defined in <cstddef>, so we might as well include that standard header instead of defining NULL ourselves.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #33
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,420
    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.

Page 3 of 3 FirstFirst 123
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 Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21