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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:59:50+00:00 2026-06-17T11:59:50+00:00

I define an enums using include,since there are different enums which have the same

  • 0

I define an enums using include,since there are different enums which have the same enumeration data and I want to reuse it:

#define X(SYM) SYM
#define X_INIT(SYM,VAL) SYM = VAL
/// Destination for scalar memory read instruction
enum SSRC
{

#include "GenericInstructionFields1.h"
#include "ScalarInstructionFields.h"
#include "GenericInstructionFields2.h"

};
enum SDST
{

        #include "GenericInstructionFields1.h"
};

#undef X_INIT
#undef X
};     

But I can`t compile the code for SDST. The compiler writes redefinition for a fields of SSRC,which comes from “GenericInstructionFields1.h”. What is the cause of the problem and how can it be solved?

//GenericInstructionFields1.h
/// SGPR0 to SGPR103: Scalar general-purpose registers.
X_INIT(ScalarGPRMin,0),
X(ScalarGPR),
X_INIT(ScalarGPRMax,103),
/// 104 – 105 reserved.
X(Reserved104),
X(Reserved105),
X_INIT(Reserved,2),
/// vcc[31:0].
X_INIT(VccLo, 106),
/// vcc[63:32].
X(VccHi),
  • 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-17T11:59:51+00:00Added an answer on June 17, 2026 at 11:59 am

    Enums are not like namespaces.

    You will see the same error with the following

    enum A
    {
        P, Q
    };
    
    enum B
    {
        P, Q
    };
    

    You can achieve what you want by this

    struct A
    {
        enum { P, Q };
    };
    
    struct B
    {
        enum { P, Q };
    };
    

    You can now use A::P, A::Q, B::P & B::Q

    Or in your case

    #define X(SYM) SYM
    #define X_INIT(SYM,VAL) SYM = VAL
    /// Destination for scalar memory read instruction
    
    struct SSRC
    {
        enum
        {
    
            #include "GenericInstructionFields1.h"
            #include "ScalarInstructionFields.h"
            #include "GenericInstructionFields2.h"
    
        }
    
    };
    
    struct SDST
    {
        enum 
        {
            #include "GenericInstructionFields1.h"
        }
    };
    
    #undef X_INIT
    #undef X
    };
    

    You can now use SSRC::ScalarGPRMax and SDST::ScalarGPRMax

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

Sidebar

Related Questions

Is it possible to define operators for enums? For example I have enum Month
I have a header file with all the enums listed (#ifndef #define #endif construct
I have a few enums in my program and I want to share it
I have class like below #include <iostream> #define Gb MemorySizeUnit.Gb #define Mb MemorySizeUnit.Mb #define
We are using XML to define a schema for controlling the contents which can
I have the following pieces of code: Leomedia.h #include MusicMetaDatter.h #ifndef LEOMEDIA_H #define LEOMEDIA_H
Is there a standard way to using Enums in EF code-first? There seems to
I'm using std::error_code and have a bunch of error's defined (using enum class) and
I have defined my Enums like this. public enum UserType { RESELLER(Reseller), SERVICE_MANAGER(Manager), HOST(Host);
Is there a way to define an enum in AS3 in a way we

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.