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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:48:38+00:00 2026-06-17T22:48:38+00:00

Possible Duplicate: struct bitfield max size (C99, C++) Is there a limit to the

  • 0

Possible Duplicate:
struct bitfield max size (C99, C++)

Is there a limit to the number of bits that I can specify in a bit field in C or C++? For example, could I do this:

struct HugeInt {
    int myInt: 1000;
};

I’m asking about both C and C++, since I know that the language specs sometimes differ and wanted to see if the above example was guaranteed to work / not work in C or C++.

  • 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-17T22:48:39+00:00Added an answer on June 17, 2026 at 10:48 pm

    In C11, section 6.7.2.1, clause 4:

    The expression that specifies the width of a bit-field shall be an integer constant expression with a nonnegative value that does not exceed the width of an object of the type that would be specified were the colon and expression omitted. If the value is zero, the declaration shall have no declarator.

    So in short, it must be between zero and the size of the type if it had not had a bit-field part.

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

Sidebar

Related Questions

Possible Duplicate: How to wrap a Struct into NSObject Can the new Clang Objective-C
Possible Duplicate: Difference between 'struct' and 'typedef struct' in C++? Is there a difference
Possible Duplicate: How do I find the size of a struct? Struct varies in
Possible Duplicate: Modify Struct variable in a Dictionary Why is it that MyStruct test
Possible Duplicate: Size of struct with a single element Given any type A and
Possible Duplicate: Bitfield manipulation in C I saw some c codes, typedef a struct,
Possible Duplicate: determine size of dynamically allocated memory in c I have a struct
Possible Duplicate: What does 'unsigned temp:3' means struct Test { unsigned a : 5;
Possible Duplicate: How can I convert a list<> to a multi-dimensional array? I want
Possible Duplicate: How can I understand nested ?: operators in PHP? Why does 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.