[The visible code cuts off here. A code map to the right indicates that this pattern continues for hundreds or thousands of lines. Given that the largest number of bits shown is 8, it is reasonable to assume the numbers count up to at least 255.]
This is actually a C header file, and binary literals in C are still not part of the standard. They are proposed as part of the C23 standard, which practically means they'll become a thing in the language somewhere from 2020 to 2023, depending on the compiler vendor. Even then, using them in your code will make it impossible to compile for anyone using an older standard of the language. Which is, considering how little C evolved over the last decades, is probably going to be true for a vast majority of C programmers.
Given these circumstances, this is a relatively practical solution that will work no matter which compiler you use, and at no runtime cost.
You literally pointed at an API reference, showing you how to specify these numbers ... not the actual code.
Just goes to show you... there are far too many bandwagoners on this platform, who don't understand fsck all about what they're actually looking at... kinda like high school, all over again.
Edit: And the reference appears to come from a path on your local hard drive ... so who the hell knows? Where's the actual code base, if you're alleging this is Arduino code???
Delete what? The fact that people will upvote something without researching something, just because it sounds good, before they properly understand it, themselves ???
31
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Nov 04 '21
Image Transcription: Screenshot
[The screenshot shows an IDE with a file named
Binary.hselected, displaying the following code:][The visible code cuts off here. A code map to the right indicates that this pattern continues for hundreds or thousands of lines. Given that the largest number of bits shown is 8, it is reasonable to assume the numbers count up to at least 255.]
I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!
16
u/AutomaticPotatoe Nov 04 '21
This is actually a C header file, and binary literals in C are still not part of the standard. They are proposed as part of the C23 standard, which practically means they'll become a thing in the language somewhere from 2020 to 2023, depending on the compiler vendor. Even then, using them in your code will make it impossible to compile for anyone using an older standard of the language. Which is, considering how little C evolved over the last decades, is probably going to be true for a vast majority of C programmers.
Given these circumstances, this is a relatively practical solution that will work no matter which compiler you use, and at no runtime cost.
67
u/ign1fy Nov 04 '21
Is this that binary tree thing I've been hearing about?
10
u/Scibbie_ Nov 04 '21
I mean, considering it's in preprocessor, not the worst thing on the planet. Wonder how it affects compile time lol
5
u/[deleted] Nov 04 '21
that is how binary literals work
3
u/darkreddragon24 Nov 04 '21
I mean it looks kinda cool
1
u/Shlaggy Nov 04 '21
Just wtf
-21
u/russellvt Nov 04 '21
Talk about writing something just for that sweet, sweet fake karma and internet points... ugh
1
u/[deleted] Nov 05 '21
[removed] — view removed comment