odd typedef summary (100+ lines)

Michael Barker mbarker at bbnz.ARPA
Tue Nov 12 01:08:30 AEST 1985


(with apologies for the length)

Some time ago, I sent a short test program out on the net for fun - I've
included it again at the end for those of you who missed it the first
time around...

and, here's what you've been waiting for :-)

summary of responses as of 11 Nov 1985

compiles and works

    CPZ-48000 (z-80 cpm 2.2) Manx C                   
    Zenith Z-120 MS-DOS 2.11 Lattice C 2.14           
    Perkin-Elmer 3220 running v7                      
    TOPS-20 (DEC-20) v7 compiler from New Mexico Tech 
    BBN C-70 v7 compiler                              
                                                      
Fails to compile (error type, then the list)
                                                                               
    "ips.c", line 23: compiler error: compiler takes alignment of function     
                                                                               
    VAX ULTRIX                                                                 
    VAX VMS 3.7  ??? C                                                         
    AT&T 370 C compiler running on CMS                                         
    Sun workstations with Sun OS 2.0 (a modified 4.2BSD)                       
    Masscomp                                                                   
                                                                               
    Line 10: ; expected (points to first character of fist in the ford fist    
    declaration)  Numous other error messages, including declaration mismatch  
    at line 22.                                                                

    Microware os9/6809 cc1:                                                    
                                                                               
    line 24: ; where other token expected (; at end of printf!!!!)             

    Prime C 1.1-19.1:                                                          
                                                                               
thanks to:

    Pawka <PAWKA at NOSC-TECR>                           
    Bob Larson <BLARSON%ECLD at ECLA>                       
    "Josh Knight"   <JOSH%YKTVMH.BITNET at WISCVM.ARPA>     
    Scott J. Kamin <ihnp4!onecom!sjk%seismo.UUCP at bbnccv> 
    Dave Sherman <ihnp4!utzoo!lsuc!dave at Berkeley>        
    Terry Poot <ndm20!tp%smu.csnet at CSNET-RELAY.ARPA>     
    Greg Titus <GREG at pinon.tccnet>                       
                                                         
    While I'm not a compiler expert, five systems saying yes and seven
saying emphatically no seems like a problem.  I think the ones saying no
may be derivatives of PCC, while the others seem more likely to have
"homebrew" compilers (no derogative intent, I assure you).  Anyone
feel like raising this issue with the ANSI C folks?  Incidentally, our
local compiler experts say it should be ok, while various other people
have had (of course) various opinions.

    Thanks again
    mike

ARPA: mbarker at bbnz.ARPA
UUCP: harvard!bbnccv!mbarker
------------(repeat of previous message, edited for brevity)-------------
two relatively simple (I hope) questions:

1.  please test the following program on your compiler.  Does it work?
2.  should it?

this is what a run of the program gives:
before use 1
that's the rub
after use 3

this is what lint had to say
"ips.c", line 23: compiler error: compiler takes alignment of function
----------------------------cut here-------------------------------
/* test program to show quirk in typedef's
 */

#include <stdio.h>

typedef ford();         /* this is questionable statement 1 */

main()
    {
    ford fist;          /* declare the function? question 2 */
    int some;           /* just filler */

    some = 1;

    printf("before use %x\n",some);

    some = fist();  /* use it */

    printf("after use %x\n",some);
    }

ford fist               /* see, mom, no parentheses? question 3 */
    {                   /* this is line 23 ??? */
    printf("that's the rub\n");

    return(3);          /* simple, eh? */
    }
-----------------------(that's all, folks)-------------------------



More information about the Comp.lang.c mailing list