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

  • Home
  • SEARCH
  • 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 526789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:48:50+00:00 2026-05-13T08:48:50+00:00

#ifndef NULL #define NULL NULL #endif This code compiles in gcc with no warnings/errors.

  • 0
#ifndef NULL
#define NULL NULL
#endif

This code compiles in gcc with no warnings/errors. Can someone explain what the preprocessor is doing here?

  • 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-13T08:48:51+00:00Added an answer on May 13, 2026 at 8:48 am

    Anywhere the compiler sees the text “NULL” it will replace it with the text “NULL”. It’s like doing a search-and-replace in your code for “NULL” and replacing with “NULL”. Not illegal, just weird 🙂

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

Sidebar

Related Questions

In c\c++ can define: #ifndef <token> /* code */ #else /* code to include
#ifndef DELETE #define DELETE(var) delete var, var = NULL #endif using namespace std; class
#ifndef MACROS_NULLCHECK_H_ #define MACROS_NULLCHECK_H_ #include <assert.h> #define NULLCHECK(x) assert(x != (void *) 0); #endif
I have a header file like this: #ifndef __GEN_NOTE_MARKERS_TO_DEVELOPERS_HPP__ #define __GEN_NOTE_MARKERS_TO_DEVELOPERS_HPP__ #ifdef _DEBUG //
The class corresponding to this crash is: #ifndef IMAGE_DATA_ #define IMAGE_DATA_ #include <stdexcept> template
When I run the following code... #ifndef KEYEDITEM_H_INCLUDED #define KEYEDITEM_H_INCLUDED #include <string> typedef std::string
I am trying to use this code to define the APIs that are needed
I have the following code in a header file: #ifndef BUFFER_H #define BUFFER_H #include
#ifndef C_H #define C_H #include <memory> class C { public: C(){}; ~C() {}; };
FILE #1 (foo.h): #ifndef FOO_H_ #define FOO_H_ #include baseclass.h #include bar.h class Bar; class

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.