Xref: utzoo comp.lang.c:8406 comp.sys.ibm.pc:13505 Path: utzoo!utgpu!water!watmath!watdragon!violet!ajmyrvold From: ajmyrvold@violet.waterloo.edu (Alan Myrvold) Newsgroups: comp.lang.c,comp.sys.ibm.pc Subject: Re: C declaration styles Message-ID: <5906@watdragon.waterloo.edu> Date: 22 Mar 88 06:20:28 GMT References: <5699@watdragon.waterloo.edu> <1065@sask.UUCP> Sender: daemon@watdragon.waterloo.edu Reply-To: ajmyrvold@violet.waterloo.edu (Alan Myrvold) Organization: U. of Waterloo, Ontario Lines: 42 In article <1065@sask.UUCP> coleman@sask.UUCP (Geoff Coleman @ College of Engineering) writes: > Xref: sask comp.lang.c:6877 comp.sys.ibm.pc:10098 + (ajmyrvold@violet.waterloo.edu) >> I need help porting C programs around. >> >> When I write my C functions on my personal computer, my declarations >> are often like this : >> >> void foo(int x, double y) > > Could you please tell us what kind of PC (if not an MS-DOS) >and what kind of compiler you ate using. The above isn't Lattice >or Microsoft and I would be suprised if it is Turbo. > Sorry for the omission - I assumed that most people would recognize the above as ANSI standard C. I am using Turbo C version 1.0 on an IBM XT under PC DOS 3.3. Turbo C supports both ANSI and K&R. My other mistake was assuming that most people would recognize the advantage of the above prototype over K&R C - It lets the compiler do type checking and coerce the arguments of a function call to proper type if necessary. Unfortunately, the most desirable style is not always the most portable. A program to convert from ANSI C to K&R has not yet been brought to my attention ... The moral for C (as for every other programming language) is to code in a manner to be as portable as possible across machines, compilers, and dialects of the language, and thus obviate the need for non-standard preprocessors in the conversion process. ------------------------------------------------------------------- Siento mucho no poderme casar con ella. Mi mujer se opondria. ------------------------------------------------------------------- Alan Myrvold ajmyrvold@violet.waterloo.edu -------------------------------------------------------------------