Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7162653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:46:14+00:00 2026-05-28T13:46:14+00:00

I have seen below macro in many topmost header files: #define NULL 0 //

  • 0

I have seen below macro in many topmost header files:

#define NULL 0  // C++03

In all over the code, NULL and 0 are used interchangeably. If I change it to.

#define NULL nullptr  // C++11

Will it cause any bad side effect ? I can think of the only (good) side effect as following usage will become ill-formed;

int i = NULL;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:46:15+00:00Added an answer on May 28, 2026 at 1:46 pm

    I have seen below macro in topmost header file:

    You shouldn’t have seen that, the standard library defines it in <cstddef> (and <stddef.h>). And, IIRC, according to the standard, redefining names defined by standard header files results in undefined behaviour. So from a purely standardese viewpoint, you shouldn’t do that.


    I’ve seen people do the following, for whatever reason their broken mind thought of:

    struct X{
      virtual void f() = NULL;
    }
    

    (As in [incorrectly]: “set the virtual table pointer to NULL“)

    This is only valid if NULL is defined as 0, because = 0 is the valid token for pure-virtual functions (§9.2 [class.mem]).

    That said, if NULL was correctly used as a null pointer constant, then nothing should break.

    However, beware that, even if seemingly used correctly, this will change:

    void f(int){}
    void f(char*){}
    
    f(0); // calls f(int)
    f(nullptr); // calls f(char*)
    

    However, if that was ever the case, it was almost certainly broken anyways.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In many tutorials, i Have seen the code below : response.setStatus( ...); What is
I have seen many programs consisting of structures like the one below typedef struct
I have seen a piece of sql injection example code like below, what does
I have seen the code below written 3 different ways (with regards to IBOutlet)
I have nested ObsevableCollections as seen below. For simplistic reason this is sample code
I have seen many places using Math.floor() and Math.random() like below $('a.random-color').hover(function() { //mouseover
I have some C++ code (segment seen below), I need to convert this to
Many of you will have seen an error like the one below. Now, I
I have seen some code like below, and it is strange that the __get
I have a Perl script which nests foreach loops as seen below. It takes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.