www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/18/10:49:27

Message-Id: <2.2.32.19970218200208.00692430@mailhost>
Mime-Version: 1.0
Date: Tue, 18 Feb 1997 18:02:08 -0200
To: djgpp AT delorie DOT com
From: Eyal Ben-David <eyalb AT aks DOT com>
Subject: Re: delete NULL?

At 05:37 PM 2/17/97 EST, fwec AT juno DOT com (Mark T Logan) wrote:
>
>Thank you for your reply.  However, I have one question.  If NULL always
>equals 0 in C++, why shouldn't I use NULL?
>

On most compilers you can, since they #define NULL to 0 in C++ mode.
for example:

#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void*)0)
#endif

Check the headers of your compiler. Note that when using NULL in C++ your
program is not portable. Best thing is to use 0.

Eyal 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019