Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
ddephor44467yThat's quite common especially on older code which had been in contact with dubios compilers from ages ago which may not have it built in.
But usually it looks like
#ifndef true
#define true 1
#define false 0
#endif -
@Kiralin I rarely do that too, but he is new, so I can forgive him for that...
It's already quite a feat he comments his code in the first place... I see many more advanced "programmers" that don't do that at all -
Kiralin957y@FinlayDaG33k thats true, i try to do it as often as I can while working on personal projects lol. But I forget mostly (with my css) so I need to get better at it. My javascript is so full of comments... it seems like there are more comments than actual code lol.
-
@Kiralin my code is generally using rough comments.
so I just say: this is what happens in this block
not: this is what happens on this line exactly -
@j4cobgarby Ye, that was actually the issue once I compiled the thing myself :p (didn't notice it at first because I looped a bit farther into the code)
-
Root797737yFalse is 0, but True is not 1.
True is !False, or all bits set.
Thus any number & True will be truthy (non-zero), but any number & False will be 0.
Breaking example with True==1:
128 & 1 == 0 -
@Root in C, any number that isn't 0 is true, so this would work
Edit: just read the last part of your comment: why would you 'and' something with true? That's unclear what it would do -
xewl41266y
Related Rants
Helped somebody learning Arduino (he is new to programming in general)...
I saw this at the top of his file...
I admire his effort tho...
rant
arduino
true/false