Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!linus!philabs!cmcl2!seismo!brl-tgr!tgr!mbarker@bbnz.ARPA From: mbarker@bbnz.ARPA (Michael Barker) Newsgroups: net.lang.c Subject: odd typedef summary (100+ lines) Message-ID: <3104@brl-tgr.ARPA> Date: Mon, 11-Nov-85 10:08:30 EST Article-I.D.: brl-tgr.3104 Posted: Mon Nov 11 10:08:30 1985 Date-Received: Wed, 13-Nov-85 04:17:52 EST Sender: news@brl-tgr.ARPA Lines: 103 (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: PawkaBob Larson "Josh Knight" Scott J. Kamin Dave Sherman Terry Poot Greg Titus 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@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 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)-------------------------