[net.lang.c] oddity

mbarker@BBNZ.ARPA (Michael Barker) (09/13/85)

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

    If I get replies, I'll summarize sometime...
    If the net gets flames, we'll be contributing to the universal
       energy level...

    thanks
    mike

ARPA: mbarker@bbnz.ARPA
UUCP: harvard!bbnccv!mbarker

P.S.  no apologies for the indentation style - I like it.
----------------------------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? */
    }