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 8485385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:37:45+00:00 2026-06-10T20:37:45+00:00

I have found some preprocessing directives in which macro name and replacement-list are same.

  • 0

I have found some preprocessing directives in which macro name and replacement-list are same. For example, some preprocessing directives in stdbool.h provided by gcc.

#else /* __cplusplus */

/* Supporting <stdbool.h> in C++ is a GCC extension.  */
#define _Bool   bool
#define bool    bool
#define false   false
#define true    true

#endif /* __cplusplus */

I don’t understand why the programmer wrote these preprocessing directives. They are useless, and the replacements will waste time. I know that this don’t cause infinite recursion. How to avoid infinite recursion? What’s the related provisions in C standard?

  • 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-06-10T20:37:46+00:00Added an answer on June 10, 2026 at 8:37 pm

    Infinite recursion during macro replacement is prevented by C++11 standard section 16.3.4 paragraph 2:

    If the name of the macro being replaced is found during this scan of the replacement list (not including the
    rest of the source file’s preprocessing tokens), it is not replaced. Furthermore, if any nested replacements
    encounter the name of the macro being replaced, it is not replaced. These nonreplaced macro name preprocessing tokens are no longer available for further replacement even if they are later (re)examined in contexts
    in which that macro name preprocessing token would otherwise have been replaced.

    Basically, this means that a macro which appears inside its own expansion won’t be replaced again.

    The reason that true, bool, and false are defined as macros by the GCC extension is to make C++ code more compatible with C99. In C99, these are defined as macros in stdbool.h, so code may check if they are defined using e.g. #ifdef bool.

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

Sidebar

Related Questions

I have found some code which recognize circles in particular image and I was
I have found some example code that creates a gradient fill in a WPF
i have found some articles on uml sequence diagrams, which mention a reply message
By using Google I have found some nice snippets of example code for using
I have found some question which refers to my initial question : - on
Recently I have found some classes in our system which are not covered by
I have found some very useful code: RewriteEngine On RewriteCond %{HTTP_HOST} ^www.example.com$ [NC] RewriteRule
I have found some jQuery codes for show content with slide effect, but none
I have found some similar Que's on SO but had not find the solution.
I have found some posts related to search on XML but those were not

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.