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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:05:21+00:00 2026-05-26T02:05:21+00:00

I have this #define statement in legacy code I’m inspecting in C . #define

  • 0

I have this #define statement in legacy code I’m inspecting in C.

#define STEP(x)         case x: STEP ## x : WPAN_Startup_Step = x;

This is a macro to replace cases in a very big switch state machine.
I can’t understand what’s going on in this macro. What does it expand to ?

  • 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-26T02:05:21+00:00Added an answer on May 26, 2026 at 2:05 am

    ## does a concatenation, this means that the result will be something like this:

    STEP(1)
    
    case 1: STEP1: WPAN_Startup_Step = 1;
    

    or another example:

    STEP(v)
    
    case v: STEPv: WPAN_Startup_Step = v;
    

    this macro does not make to much sense to me, since it generates x: STEPx:
    maybe a usage example would clarify this.

    if you want to see the expansion of a macro use: gcc -E program.c

    also a good place to learn about macros: http://gcc.gnu.org/onlinedocs/cpp/Macros.html

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

Sidebar

Related Questions

I have a macro that looks like this: #define coutError if (VERBOSITY_SETTING >= VERBOSITY_ERROR)
I have some Objective-C code that looks like this: #define myVar 10 float f
I have this struct; #define BUFSIZE 10 struct shared_data { pthread_mutex_t th_mutex_queue; int count;
I have this class header //header for class. #ifndef Container_H #define Container_H #include <iostream>
Is it possible to define a spring-managed EJB3 hibernate listener? I have this definition
I have a header file like this: #ifndef __GEN_NOTE_MARKERS_TO_DEVELOPERS_HPP__ #define __GEN_NOTE_MARKERS_TO_DEVELOPERS_HPP__ #ifdef _DEBUG //
If we define a property as public property and in this property we have
I have seen this macro defined before but never really knew its purpose. Can
I have the following legacy code that I would like to mimic, with all
I have a LINQ Distinct() statement that uses my own custom comparer, like this:

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.