Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site utah-gr.UUCP
Path: utzoo!linus!philabs!cmcl2!seismo!utah-cs!utah-gr!thomas
From: thomas@utah-gr.UUCP (Spencer W. Thomas)
Newsgroups: net.lang.c
Subject: Re: What is setjmp... Clarification and typedef gripe
Message-ID: <1193@utah-gr.UUCP>
Date: Fri, 5-Oct-84 01:15:01 EDT
Article-I.D.: utah-gr.1193
Posted: Fri Oct  5 01:15:01 1984
Date-Received: Sat, 6-Oct-84 02:14:43 EDT
References: <22197810.8e4@apollo.uucp> <981@bbncca.ARPA>
Reply-To: thomas@utah-gr.UUCP (Spencer W. Thomas)
Organization: Univ of Utah CS Dept
Lines: 45
Summary: 

>> 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?
>> 

I tried this on our apollo C compiler (the obvious one, given the return
address), and discovered that it complains (as above) about typedefs
for which the underlying type is an array, but not for structs or
"primitive" types (such as int).  On our Vax, similar code gives the
output
  "tst.c", line 7: warning: & before array or function: ignored
  "tst.c", line 7: warning: illegal pointer combination
  "tst.c", line 8: warning: illegal pointer combination
(line 7 said tmp = &foo, and line 8 said tmp = foo).  The problem seems
to be the underlying array type.

=S