Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!munnari.oz.au!bruce!cechew From: cechew@bruce.OZ (Earl Chew) Newsgroups: comp.os.minix Subject: Re: New wait.h Message-ID: <1688@bruce.OZ> Date: 13 Nov 89 01:50:57 GMT References: <4507@ast.cs.vu.nl> Organization: Monash Uni. Computer Science, Australia Lines: 28 From article <4507@ast.cs.vu.nl>, by ast@cs.vu.nl (Andy Tanenbaum): > In article <1684@bruce.OZ> cechew@bruce.OZ (Earl Chew) writes: >>#define WIFSIGNALED(__s) ((unsigned int) ((__s) - 1 & 0xffff) < 0xff) > > You may be right, but I find mine an awful lot clearer: > > #define WIFSIGNALED(--s) (_HIGH(__s) == 0 && __s != 0) > > Does anyone know if mine is ok? No it's not ok :-) #define WIFSIGNALED(__s) (_HIGH(__s) == 0 && (__s) != 0) I think that the standard does not impose any rules about macros (it does about functions implemented as macros) -- so you are ok. However, I feel that where there is an alternative, you are better off coding safe macros so that you won't get a surprise some time later. The point about clarity is valid but I think that safety is more important. Furthermore, the code is hidden within a macro and there's only 1 short line --- clarity is not a big issue in this case. Earl -- Earl Chew, Dept of Computer Science, Monash University, Australia 3168 ARPA: cechew%bruce.cs.monash.oz.au@uunet.uu.net ACS : cechew@bruce.oz ----------------------------------------------------------------------