18
monkcs
3y

I got this function skeleton to implement, who the fuck return a Boolean value using a int64?!?

Why are C programmers so damn insistent of never using the _Bool type that is in the damn language since C99? Have they been living under a rock since 1999?

// An irritated C++ programmer

Comments
  • 3
    Ah yes, if(0)
  • 0
    @melezorus34 well, that part is for me to implement to be fair
  • 0
    int returnZero() return 0;
  • 5
    Cause it might not compile on a K&R compiler.
  • 4
    Well afaik Bool is just a typedef to an int anyway. But why int64? Why not just int?
  • 2
    @Lensflare yeah, but _Bool is an int type big enough to hold 0 and 1. And by letting the compiler know it explicitly is a _Bool it can help the optimization
  • 3
    @Demolishun haha yeah it will break all my codebase on my PDP-7
  • 7
    Are you seriously expecting C programmers to move on from the 80s/90s...

    (lol jk, before I get massacred by the "low level" gang)
  • 2
    @RememberMe no one expects them tbh
  • 3
    @RememberMe Summoning @Fast-Nop

    Now your gonna get it! lol
  • 2
    That can make sense in order to harmonise the APIs so that they have always the same return type. What's actually fucked up here is "i64" instead of int64_t. I take that "if (0)" BS as placeholder for later implementation of actual logic.

    Also, I never use _Bool because using something else leaves the option of using 0 for "ok" and introducing more detailed error codes later. Like, getting the boolean info, but if a closer look is required, also a reason for "why not".

    @RememberMe Of course not because that was before millennials entered the game and things still made sense. :P
  • 0
    Because when I'm programming in C it's often for hobby projects where I may actually encounter an ancient compiler.
Add Comment