13

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...

Comments
  • 0
    That'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
  • 8
    Im Dutch too but I never add Dutch comments in my code file hah. Funny to see.
  • 1
    @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
  • 0
    @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.
  • 1
    @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
  • 1
    @FinlayDaG33k I'll probably go to that soon when I understand it better 😂
  • 2
    Those semicolons will break things

    If (true) will expand to if (1;)
  • 1
    @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)
  • 3
    Ya. That used to be a thing. Because bool wasn't a valid data type.
  • 3
    False 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
  • 1
    @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
  • 0
    @j4cobgarby so, in that regard...
    #define true 1;
    makes
    69 == true
    ???? xD I sure hope not...
  • 0
    @xewl in C, 69 is true
  • 0
    @j4cobgarby that I hope so, don't get me wrong
Add Comment