Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

50%
+0 −0
Q&A Alternatives better to the binary "0b..." format?

In our documentation, we write binary numbers like this: 1010 But we write hexadecimal numbers like this: 0xABAB Now, according to the GCC compiler conventions: Numbers are normally written in...

2 answers  ·  posted 7y ago by Yoel‭  ·  last activity 5y ago by System‭

#3: Attribution notice added by user avatar System‭ · 2019-12-08T08:04:06Z (almost 5 years ago)
Source: https://writers.stackexchange.com/q/33563
License name: CC BY-SA 3.0
License URL: https://creativecommons.org/licenses/by-sa/3.0/
#2: Initial revision by user avatar Yoel‭ · 2019-12-08T08:04:06Z (almost 5 years ago)
In our documentation, we write binary numbers like this: **1010**

But we write hexadecimal numbers like this: **0xABAB**

Now, according to the GCC compiler conventions:

- Numbers are normally written in **decimal**. 
- Binary numbers are preceded by **0b**.
- Hexadecimal numbers are preceded by **0x**. 

But in my mind, writing binary numbers as **0b1010** just looks wrong. But I can't tell my writers "don't do it because it looks wrong", especially because we write the hex numbers with a **0x** prefix.

Are there any programmers out there who can weigh in on why I **shouldn't** use the **0b** prefix? I need reinforcements :).

#1: Imported from external source by user avatar System‭ · 2018-01-31T13:17:40Z (almost 7 years ago)
Original score: 7