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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T06:13:17+00:00 2026-05-19T06:13:17+00:00

A while ago I have discovered an (rather ancient) C Compiler, which scanned macros

  • 0

A while ago I have discovered an (rather ancient) C Compiler, which scanned macros this way (Pseudo code):

 if line.startswith("#include") or line.startswith("#define"):
     ...

.. Which kind of raised the question for me where macros should really be placed, at the beginning of a line, like so:

void stuff()
{
#if defined(WIN32) || defined(_WIN32)
    ...
#else
#if defined(__GNUC__)
    ...
#else
    ...
#endif
#endif
}

Or rather like so (as that’s the way I do it, for improved readability):

void stuff()
{
    #if defined(WIN32) || defined(_WIN32)
    ...
    #else
    #   if defined(__GNUC__)
    ...
    #   else
    ...
    #   endif
    #endif
}

Is the way one indents the Preprocessor code standardized, that is, no matter how i indent it, it will always work the same way?

  • 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-19T06:13:18+00:00Added an answer on May 19, 2026 at 6:13 am

    Some old C compilers required that the #define (for example) be flush with the left margin:

    #define FOO bar
    

    Other C compilers required only that the # be at the left margin, so you could:

    #    define FOO bar
    

    Newer C compilers tend to accept the # after any leading whitespace:

        #define FOO bar
    

    If you want compatibility with such older compilers, you should at least put your # in the first column. If compatibility doesn’t matter, then it’s up to you.

    I would usually try not to embed #ifdef blocks inside functions, so the whole question of whether they should be indented mostly goes away.

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

Sidebar

Related Questions

I have used IPC in Win32 code a while ago - critical sections, events,
I have some AS3 MP3 code that my teacher gave me a while ago
I have question quite much related to this one I asked a while ago
I have posted this question a while ago but got a partial answer to
I have the following php function which i wrote a while ago. Now however,
I have a file x.cpp which a while ago contained, say, AAAAAAA. I accidentally
I have the following text from an academic course I took a while ago
A while ago, I came across some code that marked a data member of
Update I asked this question quite a while ago now, and I was curious
A while ago I noticed I don't have a magnifying-glass next to my datatables.

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.