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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:41:56+00:00 2026-05-28T04:41:56+00:00

Please help me understand the meaning of this code. I have seen this kind

  • 0

Please help me understand the meaning of this code. I have seen this kind of usage for the first time

typedef enum {

        E_1_DEFAULT = 0,
        E_1_1,
        E_1_2,
        E_1_3,
        E_1_4,
        E_1_5,
        E_1_255 = 255           //needs at least 8Bit

} APPLICATION_ENUM_1;                           

typedef enum {

        E_2_DEFAULT = 0,
        E_2_1,
        E_2_2,
        E_2_3                   //needs at least 2Bit

} APPLICATION_ENUM_2;                           

typedef enum {

        E_3_DEFAULT = 0,
        E_3_1,
        E_3_2,
        E_3_3,
        E_3_4,
        E_3_5,
        E_3_666 = 666           //needs at least 10Bit

} APPLICATION_ENUM_3;



typedef struct {

        APPLICATION_ENUM_3      var3:10;                // 10Bit
        APPLICATION_ENUM_1      var1:8;         // 18Bit
        APPLICATION_ENUM_2      var2:2;         // 20Bit
        uint8                   unnused_1:4;   // fill up the last whole byte -> 24Bit = 3byte

} APPLICATION_RAM;;
  • 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-28T04:41:57+00:00Added an answer on May 28, 2026 at 4:41 am

    According to the C++ standard

    The underlying type of an enumeration is an integral type that can represent all the enumerator values defined in the enumeration.

    Now lets look at the first definition

    typedef enum {
    
            E_1_DEFAULT = 0,
            E_1_1,
            E_1_2,
            E_1_3,
            E_1_4,
            E_1_5,
            E_1_255 = 255           //needs at least 8Bit
    
    } APPLICATION_ENUM_1; 
    

    definition E_1_255 = 255 ensures that all values from 0 to 255 can be represented by this enum type and you need at least 8bits to represent all values from 0 to 255

    typedef struct {
    
            APPLICATION_ENUM_3      var3:10;                // 10Bit
            APPLICATION_ENUM_1      var1:8;         // 18Bit
            APPLICATION_ENUM_2      var2:2;         // 20Bit
            uint8                   unnused_1:4;   // 24Bit = 3byte
    
    } APPLICATION_RAM;
    

    The above struct is using a seldom used bitfield construct. Basically declaring the APPLICATION_RAM as a struct that has a

    • var3 member that is 10 bits
    • var1 member that is 8 bits
    • var2 member that is 2 bits
    • unnused_1 member that is 4 bits
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please help me understand 2 things I found in this C code: First, there
I cannot understand how this is possible. Please help!! I have an app with
Please help me understand what is wrong with my code. Header File typedef void
Someone please help me understand why this binding does not work... I have a
Please help me understand what this typedef is doing?? typedef void (xyz) (void *data);
please help me understand this. You have a function that calls a few methods:
Please help me understand this. Here you can see that I have PYTHONPATH set
Please help me understand this code. I am new to java. // C.java class
Please help me understand this recursive function... var stack = Array; function power(base, exponent){
the following code is not behaving like I would expect. Please help me understand

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.