Portability enhancing C extension

Damon Permezel dapermezel at watmath.UUCP
Sat Oct 1 07:09:51 AEST 1983

The addition of the ability to type the expected args of an external function
is definitely needed in C. All you VAX-C programmers have lead a sheltered
life and can't be expected to realise the need. Consider the much abused


where 'f' is

char *p; { ... }

This works fine on the VAX, but will not work on a HW level-6, which has
different sizes for each of 'int', 'int *' and 'char *'. It will also fail
on the 68000, where sizeof(int) == 2 and sizeof(int *) == sizeof(char *) == 4.

When we ported our compiler source from the HW DPS/8 (sizeof(most_stuff) == 4)
to the level-6, we had one hell of a time (we had no lint then). If my
language extension that allows

extern f(char *);

had been working then, most of the problems would have gone away with the
inclusion of a "ext_def.h" file that defined the arg types, allowing the
compiler to add the cast where necessary.

I was very reluctant to add any language extensions to my parser, but
this one i definitely consider worthwhile.


More information about the Comp.lang.c mailing list