3 ms·
Ask HN: Does anyone else use "and" and "or" in C (iso646.h)?
Just trying to settle a friendly "coding style" debate I'm having with some colleagues. :-)
They're keen on using the spelled-out "and" and "or" as per iso646.h in our code, rather than the standard && and || operators. Admittedly they do look nice, and match well with our Python code. But it's weird to see them in C, and I've never seen them anywhere else on The Internet.
(If you've never seen "and" and "or" used in C, you can read about them and iso646.h here: http://en.wikipedia.org/wiki/Iso646.h)
So I'm just curious: Does anyone else use them? Either yourself or in an open-source project you've seen?
- pmarin 18y agoAmazing. the wikipedia says: "which, without the header file, cannot be quickly or easily typed on some international and non-QWERTY keyboards" Anyone have one of those keyboards?
- unwind 18y agoWow ... I consider myself reasonably well-versed with C, and I had never heard of that header. I would of course, bias and all, consider any programmers deciding to use it to be well out of touch with reality. I don't see a real-world benefit either, all it does is make those guys feel macho and elite for knowing something (of little value, in my opinion), and making the code hugely harder to maintain. Ask a manager, while providing some kind of statistical data showing how common use of this header is in C code "in the wild". A quick search with code.google.com gives _0_ hits for "iso646.h", that tells me something.
- lhorie 18y agoI'd think using those forms would be analogous to using different variable naming conventions in the same codebase or having no conventions for "{" placement. That in itself is not so bad, but it can possibly lead to the sort of environment where everyone has their own little version of common helper macros / function / libraries.