Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!necntc!ima!cfisun!lakart!dg From: dg@lakart.UUCP (David Goodenough) Newsgroups: comp.lang.c Subject: Re: C Style (Was Re: == vs =) Message-ID: <74@lakart.UUCP> Date: 28 Apr 88 16:35:42 GMT References: <175@obie.UUCP> <255@oink.UUCP> Organization: Lake - The systems people Lines: 29 From article <175@obie.UUCP>, by wes@obie.UUCP (Barnacle Wes): > In article <255@oink.UUCP>, jep@oink.UUCP (James E. Prior) writes: >> if (var==TRUE) >> >> is not only abominable, it can be dangerous. var==TRUE tends to presume >> that the only valid values of var are FALSE and TRUE. > > Right. The only really safe way to do this is: [safe and silly way deleted] Why can no one see the forest because of all the trees getting in the way? if (var != FALSE) will *_ALWAYS_* work NO MATTER WHAT, and it satisfies those that need to test their booleans in a strange manner. if (var) is what I use when testing a boolean, and if it's an integer then I say if (var != 0) which is what I usually mean. -- dg@lakart.UUCP - David Goodenough +---+ | +-+-+ ....... !harvard!adelie!cfisun!lakart!dg +-+-+ | +---+