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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:38:10+00:00 2026-06-14T15:38:10+00:00

How many passes does the C preprocessor make over the code? I tested following

  • 0

How many passes does the C preprocessor make over the code?

I tested following code on gcc 4.7.2

#define a 5
#define b a
#define c b
#define d c
#define e d
#define f e
#define g f
#define h g
#define j h
#define k j
#define l k
#define m l

int main(void) {return d;}

There is no error:

$ gcc -E 1.c
# 1 "1.c"
# 1 "<command-line>"
# 1 "1.c"
# 14 "1.c"
int main(void) {return 5;}

Is it standard behaviour?

  • 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-14T15:38:11+00:00Added an answer on June 14, 2026 at 3:38 pm

    The C preprocesor keeps going until there’s nothing more to expand. It isn’t a question of passes; it’s a question of completeness.

    It does avoid recursive expansion of macros. Once a macro has been expanded once, it is not re-expanded in the replacement text.


    The only thing the standard says about limits on macro expansion is in §5.2.4.1 Translation limits, where it says:

    The implementation shall be able to translate and execute at least one program that
    contains at least one instance of every one of the following limits:18)

    …

    • 4095 macro identifiers simultaneously defined in one preprocessing translation unit

    18) Implementations should avoid imposing fixed translation limits whenever possible.

    So, the preprocessor must be able to handle at least 4095 macros, and if all but one of those macros expand to another macro sequentially, like in your example, the result must be correct.

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

Sidebar

Related Questions

How would you fix the following bad code that passes too many parameters around?
many Places in the sample code i have seen 2 different way of @synthesize
Many ARIA demonstration websites use code such as: <label for=name id=label-name>Your Name</label> <input id=name
Does anyone have any opinions over the best ways to connect a client to
I have the following code fragment that I use to scale images. This is
I have the following design decision to make - running into it for the
How does Clojure determine how many arguments an anonymous function (created with the #...
I need to make many JQUERY AJAX Calls but I don't want to repeat
I'm writing a client that loads & parses many pages at once & sends
Many threads have access to summary . Each thread will have an unique key

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.