I know it's bad preprocessor magic, but I kinda liked that. I thought about hacking together a quick "Oberon-ish" to JS "transpiler" for a while, of course going along with a decidedly Wirth-ian code style. I might call it "werenotwirthy".
But there's also the appeal of the dreaded Incunabulum...
This particular code isn't about the post. It's about Bournegol, which doesn't actually exist anymore, and is actually quite hard to track down any examples of.
It's...not, though? The Bourne Shell was released under a free license years ago along with the rest of v7, and it's just a macro hack. Very much still exists, and pretty easy to find.
On C language an expression which evaluates to any non-zero value is considered as True. So for example this kind of statement would not likely behave as intended:
To emphasise: This is about Bournegol. Nothing to do with this post.
> Can you explain why?
Because it isn't how most C libraries expect true/false to be defined.
stdbool in C99 standardized things a bit, but before then what was generally accepted was:
> true is 1
> false is !true (Often 0 in practice).
Which means that any trivial:
if(true) { ... }
Won't work under Bournegol. Instead you _need_ to compare when doing an if statement.
So the C-programmer is easily tripped up. False will work as expected, but True won't... All the time. There may be times it does work. Leaving the programmer throwing their hands in the air.
Most cases I've seen accept anything as true as long as the LSB is 1, and quite strictly 0 as false. Everything else is up in the air. The value -1 is definitely true. :)
As far as I know, std library specifically uses the word "nonzero" in the documentation to denote non-false value. Therefore you should be using !, &&, || for any boolean ops, but never == nor !=