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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:27:08+00:00 2026-05-27T09:27:08+00:00

Is the following undefined and why? int i = 0xFF; unsigned int r =

  • 0

Is the following undefined and why?

int i = 0xFF;
unsigned int r = i << 24;
  • 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-27T09:27:08+00:00Added an answer on May 27, 2026 at 9:27 am

    The behaviour is technically undefined unless the int type has more than 32 bits.

    From C++11, 5.8/2 (describing an expression E1 << E2):

    if E1 has a signed type and non-negative value, and E1×2E2 is representable
    in the result type, then that is the resulting value; otherwise, the behavior is undefined.

    The result type of i << 24 is (signed) int; if that has 32 bits or less, then 0xff * 2^24 == 0xff000000 is not representable (the maximum representable 32-bit signed value being 0x7fffffff), so behaviour is undefined as specified in that clause.

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

Sidebar

Related Questions

I receive a g++ error (undefined reference to 'SomeClass::SomeClass(int)' and 'SomeClass::~SomeClass') with the following:
Can I confirm that the following C code gives undefined result for b: unsigned
Why does the following given expression invoke undefined behavior? int i = 5; i
I was wondering whether the following is undefined behavior // Case 1: int *p
Does the following invoke undefined behavior? int x; int i = x; Reference from
I need help! I am getting following linker errors using g++: `__static_initialization_and_destruction_0(int, int)': undefined
From this reference, In C it seems the following behavior is undefined. int my_array[100][50];
Why The constructor ArrayAdapter(new View.OnKeyListener(){}, int, String[]) is undefined in following my coding. This
Does the following program invoke Undefined Behaviour in C? int main() { printf(Printf asking:
Is it true that the following yields undefined behavior: void * something = NULL;

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.