Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site bbncca.ARPA Path: utzoo!watmath!clyde!burl!ulysses!mhuxj!ihnp4!bbncca!keesan From: keesan@bbncca.ARPA (Morris Keesan) Newsgroups: net.lang.c Subject: Re: What is setjmp... Clarification and typedef gripe Message-ID: <981@bbncca.ARPA> Date: Wed, 3-Oct-84 10:01:55 EDT Article-I.D.: bbncca.981 Posted: Wed Oct 3 10:01:55 1984 Date-Received: Thu, 4-Oct-84 02:43:28 EDT References: <22197810.8e4@apollo.uucp> Organization: Bolt, Beranek and Newman, Cambridge, Ma. Lines: 45 -------------------------------------- > From: nazgul@apollo.uucp (Kee Hinckley) > Date: Mon, 1-Oct-84 14:39:17 EDT > > I agree with this whole-heartedly, the only thing that bugs me is > the way typedef works, which is essentially as a #define. For > example: > ----------------------------------------------------------------------- > #include> #include > > main() > { > jmp_buf foo, *tmp; > > tmp = &foo; > } > $ cc foo > > (0008) tmp = &foo; > ******** Line 8: Warning: Illegal pointer combination: incompatible types. > No errors, 1 warning, C Compiler, Rev 2.40 > ------------------------------------------------------------------------- > The error message may differ on your machine, but most compilers do at > least give some warning. The way around it: > tmp = (jmp_buf *) &foo; > works, but is rather frustrating. > > The whole point of a typedef (in my mind at least) is to create a > level of abstraction that alleviates the need to learn what the machine/ > compiler architecture actually looks like. To a certain degree typedef > seems to succeed at this, but then it all falls apart. Any thoughts? > "setjmp foo, *tmp; tmp = &foo;" is accepted with no complaints by my C compiler (based on the Dennis Ritchie V7 PDP11 "cc"), as it should be, because "tmp" and "&foo" have exactly the same (defined) type. Either your C compiler has a bug in this respect, or your is #defining jmp_buf, instead of typedefing it. The thing to do is not gripe about the language, but gripe to whomever maintains your compiler, to get this bug fixed. -- Morris M. Keesan {decvax,linus,ihnp4,wivax,wjh12,ima}!bbncca!keesan keesan @ BBN-UNIX.ARPA