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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:26:10+00:00 2026-06-16T00:26:10+00:00

I have the following code in a global header, so I can make decisions

  • 0

I have the following code in a global header, so I can make decisions at compile time:

enum {
    MyStyleA,
    MyStyleB,
    MyStyleC
};

#define STYLE MyStyleB

In various source files, I include this header and do something like this:

#if STYLE == MyStyleC
    doSomething();
#endif

Problem is, doSomething() definitely gets executed even though I defined STYLE to MyStyleB in the header!

Any idea what’s going wrong here?

(I admit I am no C preprocessor expert.)

  • 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-16T00:26:11+00:00Added an answer on June 16, 2026 at 12:26 am

    I don’t have a copy of the C standards on my bedside table, so I could be wrong, but:

    The preprocessor has no idea what MyStyleC is – that doesn’t get a value until it hits the compiler.

    Compilers normally have an option (used to be -e ?) to output the results of the preprocessor phase (as text) – I’d look at that and see what your #if looks like after the preprocessor has gone over it.

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

Sidebar

Related Questions

I have the following code: <?php function foo($bar) { global $products; //$products = array();
Thank you very much for helping!!! I have the following code: base[0]='coordfinder' base[1]='editor_and_options' base[2]='global'
I have the following code which is executed from the command line: import cgi,time,os,json,sys,zipfile,urllib2
I have the following code in my Global.asax file: Protected Sub Application_PreRequestHandlerExecute(sender As Object,
Right now, in development I have the following code in the Global.asax.cs file that
I have a following code in global.asax: protected void Application_AuthenticateRequest(object sender, EventArgs e) {
If you have the following code: var global = this; function A () {
I have the following code: function dbInsert() { global $dbcon, $dbtable; global $inputData; $sqlQuery
Say I have the following JavaScript code (in global context): var t = setTimeout(f,
currently I have the following code inside my 'function.php' is function calcTime($database_name,$currentTime){ global $startTime;

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.