Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #81615

Re: NULL versus 0

From "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Newsgroups comp.lang.c++
Subject Re: NULL versus 0
Date 2021-09-26 23:37 -0700
Organization Aioe.org NNTP Server
Message-ID <siroqu$1bkg$1@gioia.aioe.org> (permalink)
References <21138a34-469b-4c7a-9ef1-e9307ba52673n@googlegroups.com> <sinp8h$f3o$1@dont-email.me> <sirlsk$5e8$5@gioia.aioe.org> <ird6s4FjatqU1@mid.individual.net>

Show all headers | View raw


On 9/26/2021 11:32 PM, Bo Persson wrote:
> On 2021-09-27 at 07:47, Juha Nieminen wrote:
>> Paavo Helde <myfirstname@osa.pri.ee> wrote:
>>> In C++ (unlike C), NULL is a macro defined to 0, so there is no
>>> difference.
>>
>> Actually, many standard library implementations define NULL to be
>> nullptr (if we are in C++11 or newer).
>>
>> (I haven't checked the standard, but this tells me that the standard does
>> not mandate NULL to be defined as 0.)
>>
> 
> It just says
> 
> "The macro NULL is an implementation-defined null pointer constant."
> 
> And then a footnote saying that 0 is one possibility, but (void*)0 is not.

OT comment: For some damn odd reason; thinking of this subject makes me 
think of the following song:

https://youtu.be/y3hf0T4qpYg

Strange!

http://fractallife247.com/test/hmac_cipher/ver_0_0_0_1?ct_hmac_cipher=e320776c84d666caf19b80ac7925f3d9e30ab3d99e0ab58d634535629abb3d2f4b8a981dc0fbd9024aca3d2a2b29de38323340cf7e700b8599ddfac7d6d5972d0a2e8b8e9d751ecf0ea7a25e9394a86496ab208cb5b846f01bdff721feb48f8ece892344689b3d8db8bb39c3b21dfe4aad2f65608c0ef1ca3737a23b63c09ba2b0dad9ccd9a81cbf3a53a480bc0a55f9be590f6e021c787972bddce2f249e45137f75884f82bc74fa8115f0339b4c1515b55dfefd1f8322f16de06c50b5e3b7381f4d044ad9cdfad661d9c677e63a5c440ef9ac49c3a78c5397fe4ee2039d79cc7d790fe11036f99b6a3e9b8a6c738a84deccdf24d1277cbc081ae42398979a04346e34e6f3a135cdf6a3cf78b771a7bf052564c27e6767ad769141be938f1c35dff31c353311989339523a3dad8a8530e2301303329aa050ce085a6135338f3bdcef27485f2843df96ce01cee17b17ef5db63b621392c7dc08487add5c382d40199a67b6978f83650e3c586d67207731ed42b954b433ef6ff8f84b06456b9394eb610b116cfefe266a185


decrypts to the following plaintext using the default key:
_____________________________
#include <iostream>

int main()
{
     void* foo = 0;
     void* foobar = NULL;
     void* foobarCpp = nullptr;

     std::cout << "foo = " << foo << "\n";
     std::cout << "foobar = " << foobar << "\n";
     std::cout << "foobarCpp = " << foobarCpp << "\n";

     return 0;
}
_____________________________

;^)

Back to comp.lang.c++ | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

NULL versus 0 "das...@gmail.com" <dashley@gmail.com> - 2021-09-25 11:03 -0700
  Re: NULL versus 0 Branimir Maksimovic <branimir.maksimovic@gmail.com> - 2021-09-25 18:16 +0000
  Re: NULL versus 0 Paavo Helde <myfirstname@osa.pri.ee> - 2021-09-25 21:20 +0300
    Re: NULL versus 0 Paavo Helde <myfirstname@osa.pri.ee> - 2021-09-25 21:32 +0300
      Re: NULL versus 0 "das...@gmail.com" <dashley@gmail.com> - 2021-09-25 12:08 -0700
    Re: NULL versus 0 Juha Nieminen <nospam@thanks.invalid> - 2021-09-27 05:47 +0000
      Re: NULL versus 0 Bo Persson <bo@bo-persson.se> - 2021-09-27 08:32 +0200
        Re: NULL versus 0 "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-09-26 23:37 -0700
        Re: NULL versus 0 "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2021-09-27 10:32 +0200
          Re: NULL versus 0 Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-09-27 11:32 -0700
      Re: NULL versus 0 James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-09-27 15:03 -0400
  Re: NULL versus 0 "see.my....@gmail.com" <see.my.homepage@gmail.com> - 2021-09-25 13:05 -0700
    Re: NULL versus 0 Jorgen Grahn <grahn+nntp@snipabacken.se> - 2021-09-26 06:58 +0000
      Re: NULL versus 0 Branimir Maksimovic <branimir.maksimovic@gmail.com> - 2021-09-26 07:47 +0000
        Re: NULL versus 0 Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-09-26 02:15 -0700
          Re: NULL versus 0 Branimir Maksimovic <branimir.maksimovic@gmail.com> - 2021-09-26 09:38 +0000
            Re: NULL versus 0 Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-09-26 15:03 -0700
              Re: NULL versus 0 Branimir Maksimovic <branimir.maksimovic@gmail.com> - 2021-09-29 02:29 +0000
                Re: NULL versus 0 Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-09-28 20:34 -0700
                Re: NULL versus 0 David Brown <david.brown@hesbynett.no> - 2021-09-29 08:52 +0200
        Re: NULL versus 0 Bo Persson <bo@bo-persson.se> - 2021-09-26 13:54 +0200
          Re: NULL versus 0 Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-09-26 15:17 -0700
          Re: NULL versus 0 Branimir Maksimovic <branimir.maksimovic@gmail.com> - 2021-09-29 02:26 +0000
      Re: NULL versus 0 Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-09-26 02:17 -0700
      Re: NULL versus 0 HorseyWorsey@the_stables.com - 2021-09-26 14:20 +0000
  Re: NULL versus 0 James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-09-25 17:36 -0400
  Re: NULL versus 0 "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2021-09-26 23:05 -0700

csiph-web