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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:25:22+00:00 2026-05-29T19:25:22+00:00

In the c-based (or c-inspired) family of languages (i.e. C/C++/Objective-C/JavaScript) when typing a constant

  • 0

In the c-based (or c-inspired) family of languages (i.e. C/C++/Objective-C/JavaScript) when typing a constant number, you can simply type the number directly for its decimal value, or you can prefix it with 0x to write it via hexadecimal. JavaScript lets you even type values using Octal encoding by prefixing the number with a zero (…which is completely bonkers to me since 09 looks to be 9 but actually parses to zero! Way to confuse people! Should’ve been 8x prefix or similar, but I digress…)

What I’m wondering is if there’s an equivalent for typing things directly in binary.

For instance, I’d love to see something like this:

int x = Bx00001001; // x would equal 9, (bits 8 and 1 are set)
int x = 1x00001001; // Alternate prefix '1x' instead of 'Bx'

Just for fun, I’m actually considering writing a pre-pre-compiler to do exactly that, but again just for fun since it of course the code wouldn’t be portable.

Still, hoping there’s a standards-way to do this. Granted, yes, it’s very easy to just encode in hex (you only need to learn up to 15 after all), but again, just wondering more out of curiosity.

But really… what the heck is up with that Octal nonsense!! Crazy if you ask me!

  • 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-29T19:25:27+00:00Added an answer on May 29, 2026 at 7:25 pm

    There is no binary constants in Standard C.

    Standard C only has decimal (no prefix), octal (0 prefix) and hexadecimal (0x or 0X prefix) constants. GNU C provides binary constants as a GNU extension to C, see:

    6.60 Binary constants using the `0b’ prefix

    http://gcc.gnu.org/onlinedocs/gcc/Binary-constants.html

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

Sidebar

Related Questions

I'm currently developing a general-purpose agent-based programming language (its syntaxt will be somewhat inspired
Based on the privacy requirements from the ios store, can we include analytics like
This question was inspired by this answer to another question, indicating that you can
I'm trying to create a text based Clojure game (inspired by Land of Lisp).
Inspired by Brent Yorgey's adventure game , I've been writing a small text based
Based on a simple test I ran, I don't think it's possible to put
Based on a few posts I've read concerning version control, it seems people think
Based on all my reading there should be one GC thread to invoke all
Based on their work, how do you distinguish a great SQL developer? Examples might
Based on the response to this question: Why does C++ have header files and

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.