Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!husc6!think!bloom-beacon!hstbme.mit.edu!scs From: scs@hstbme.mit.edu (Steve Summit) Newsgroups: comp.lang.c Subject: Re: Clever C Preprocessor Definitions Sought Summary: more VMS trivia Keywords: c cpp famous Message-ID: <14007@bloom-beacon.MIT.EDU> Date: 2 Sep 89 18:03:53 GMT References: <555@stdc01.UUCP> <1424@atanasoff.cs.iastate.edu> Sender: daemon@bloom-beacon.MIT.EDU Reply-To: scs@adam.pika.mit.edu.UUCP (Steve Summit) Lines: 15 In article <1424@atanasoff.cs.iastate.edu> hascall@atanasoff.cs.iastate.edu.UUCP (John Hascall) writes: > Here is one I use on VMS where system calls return odd values for OK > and even values for various errors: > #define ODD(x) ((x)&1) > #define EVEN(x) (!ODD(x)) > #define ERROR(cond) EVEN(cond) If you do these right (I forget the exact form I used, but at least John's ODD macro would probably work) you can get the VAXC compiler to generate a single BLBS or BLBC instruction, those being two of the instructions (so the story goes) that the VAX hardware designers put in specifically at the request of the VMS software developers. (I try not to worry about such machine- level optimizations, but it's nice to know that, since the instructions are there, they're being used as intended.)