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

  • Home
  • SEARCH
  • 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 4625292
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:15:04+00:00 2026-05-22T03:15:04+00:00

It was mentioned that a well written compiler for C should carry out the

  • 0

It was mentioned that a well written compiler for C should carry out the shift opeators at compile time (i.e. not run-time); for example in this code the shift left – <<. Can anyone attest to the validity of this?

Code:

constant unsigned int elements = length/8 + (length % y > 0 ? 1 : 0);  
unsigned char bit_arr[elements];

Psuedo-Code :

bit_arr[i] |= (1 << j); // Set 
bit_arr[i] &= ~(1 << j);  // Unset
if( bit_arr[i] & (1 << j) ) // Test
  • 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-22T03:15:05+00:00Added an answer on May 22, 2026 at 3:15 am

    What are you actually asking? Do you mean “will the compiler do the shift itself”? If that’s what you’re asking the answer is “it depends” :). If the number being shifted and the size of the shift are both compile-time constants the compiler almost surely will do the shift (though it doesn’t have to). Otherwise it will generate the lower-level code that will carry out the shift (which will often be a single machine instruction).

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

Sidebar

Related Questions

When I asked this previously I should have mentioned that it's particularly a light-weight
I want to create a thread for some db writes that should not block
A coworker of mine mentioned that one use of XSLT is processing business rules.
On a related post I mentioned that I have found custom HTML helpers to
In a recent conversation, I mentioned that I was using JavaScript for a web
On the Stackoverflow podcast this week, Jeff mentioned that in 2004 he wrote a
In a previous SO question, it was mentioned that USB devices can be mounted
On SO 18 Joel mentioned an algorithm that would rank items based on their
It's been mentioned to me that I'll be the sole developer behind a large
I've seen it mentioned in many places that randomness is important for generating keys

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.