Xref: utzoo comp.lang.c:8800 comp.sys.ibm.pc:14002 Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!mailrus!tut.cis.ohio-state.edu!rutgers!iuvax!bsu-cs!dhesi From: dhesi@bsu-cs.UUCP (Rahul Dhesi) Newsgroups: comp.lang.c,comp.sys.ibm.pc Subject: Re: cdecl keyword ( re: C Decl ... ) Message-ID: <2521@bsu-cs.UUCP> Date: 31 Mar 88 16:19:44 GMT References: <1238@wjvax.UUCP> <297@ho7cad.ATT.COM> <1242@wjvax.UUCP> <7595@brl-smoke.ARPA> Reply-To: dhesi@bsu-cs.UUCP (Rahul Dhesi) Organization: CS Dept, Ball St U, Muncie, Indiana Lines: 25 In article <7595@brl-smoke.ARPA> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) writes (about the "cdecl" keyword): >Of all the useless additions to C, this one has to take the cake! >#define cdecl /*nothing*/ The real usefulness of cdecl comes when one is doing mixed language programming. Now if you compile a routine that needs to be linked with a Pascal program, you may compile it thus: cc -pascal mystuff.c If mystuff.c uses any C library function, you still want that library function to be called using the C calling convention, even though you asked the compiler to generate code for the Pascal calling convention. If mystuff.c includes a header file declaring library functions, and the header file uses the cdecl keyword for these, then the compiler will correctly use the Pascal or C calling convention, whichever is needed by the called routine. With a little foresight Microsoft could have just used the same calling convention in all its language translators. The "cdecl" keyword is a belated fix for a problem that need not have existed. -- Rahul Dhesi UUCP: !{iuvax,pur-ee,uunet}!bsu-cs!dhesi