C declaration styles

Alan Myrvold ajmyrvold at violet.waterloo.edu
Tue Mar 22 16:20:28 AEST 1988


In article <1065 at sask.UUCP> coleman at sask.UUCP 
(Geoff Coleman @ College of Engineering) writes:

> Xref: sask comp.lang.c:6877 comp.sys.ibm.pc:10098 
+ (ajmyrvold at 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 at violet.waterloo.edu
-------------------------------------------------------------------



More information about the Comp.lang.c mailing list