cdecl keyword ( re: C Decl ... )

Frank Adams franka at mmintl.UUCP
Tue Apr 19 07:34:47 AEST 1988


In article <146 at obie.UUCP> wes at obie.UUCP (Barnacle Wes) writes:
>So why should we force these MS-DOSisms on the rest of the C-speaking
>world?  ...  If your programming environment needs them, let
>them be (non-portable) extensions to the standard needed to support
>your operating system!

That's exactly what they are!  I didn't hear anybody suggesting that they be
standardized; the question that brought about the whole discussion was how
to use them in the MS-DOS environment.

It is true that, with the (proposed) ANSI standard, one could define a
calling convention for C on the 8086 which was as efficient as the Pascal
standard: namely, callee pops arguments for fixed argument list functions,
and caller pops for variadic functions.  But the C calling convention for
the machine antedates the ANSI standard; and with K&R C, the calling program
does not know whether a function is variadic.  Thus, there are good reasons
for providing the pascal convention as a compilation default; and this
necessitates a cdecl keyword.

(Yes, one *could* redefine the calling interface.  This would invalidate a
lot of existing code -- assembler routines are quite common in 8086
products.)
-- 

Frank Adams                           ihnp4!philabs!pwa-b!mmintl!franka
Ashton-Tate          52 Oakland Ave North         E. Hartford, CT 06108



More information about the Comp.lang.c mailing list