Subject: Re: rpcgen and -fshort-enums round 2
To: NetBSD Toolchain Technical Discussion List <tech-toolchain@NetBSD.ORG>
From: David Laight <david@l8s.co.uk>
List: tech-toolchain
Date: 02/20/2002 00:00:44
> 
> <soapbox>
> Function prototypes are really just a crutch for lazy programmers (and
> no C programmer can ever afford to be lazy, ANSI-C or not!).
> Unfortunately function prototypes cause worse problems than they solve
> because of the unnecessary changes that were made to the parameter
> promotion rules.  You really do not gain back enough safety features by
> being able to pack smaller types into int-sized registers or whatever.
> </soapbox>

Can I agree (for once)?

I've seen too many function prototypes where, because the DOMAIN of
an argument is [0..65535] the argument is defined as 'unsigned short'
(rather than int).  On most modern systems this causes the compiler
to generate reams of extra code to ensure that 65535+1 => 0.

IMHO local variables, parmeters and function results should almost
always be [unsigned] int - unless you require wrapping at 2^8 or
2^16.

	David

-- 
David Laight: david@l8s.co.uk