portability

Bob Larson blarson at skat.usc.edu
Sat Jan 21 11:37:29 AEST 1989


In article <16653 at iuvax.cs.indiana.edu> bobmon at iuvax.cs.indiana.edu (RAMontante) writes:
><14767 at oberon.USC.EDU> blarson at skat.usc.edu (Bob Larson) writes:
>>cdecl is a keyword only because
>>microsoft was to lazy to add a few #defines to their programs.  It does
>>nothing that could not be accomplished better in the preprocessing phase.

>Well, I'm talking specifically about TurboC's use of the keywords; in
>TC the 'cdecl' keyword means that a function follows the 'C' linking
>and arg-passing conventions, and identifiers are case-sensitive and get
>leading underbars,

Simplified, cdecl means do things as they are done in C.

> even though the overall default may be 'pascal'-like.

The compiler option to change these overall defaults is the problem,
eliminating it the proper solution, not cdecl.  To change the calling
convention from the norm, add a keyword to each fuction declaration
that may change rather than adding the compiler flag.  If there is a
need to change the calling convention at compile time, just add a
preprocesser token to all non-standard routines (such as
CALLING_CONVENTION_OF_THIS_COMPILATION) and use the compiler switch to
#define it to pascal or null or fortran.

Prime C has the fortran keyword, and never found a need for the cdecl
one.  It also runs on a segmented processor (128k bytes each), and has
no near, far, or huge keywords.  (It does have the equivelent of large
and huge model, which only affect how address computations are done on
arrays whose size cannot be deduced at compile time.)

-- 
Bob Larson	Arpa: Blarson at Ecla.Usc.Edu	blarson at skat.usc.edu
Uucp: {sdcrdcf,cit-vax}!oberon!skat!blarson
Prime mailing list:	info-prime-request%ais1 at ecla.usc.edu
			oberon!ais1!info-prime-request



More information about the Comp.lang.c mailing list