Re: K&R-Style Function Declarations: Good or Bad?
lawrence.jones_at_eds.com
Date: 12/10/03
- Next message: goose: "Re: Convert HEX string to bin"
- Previous message: glen herrmannsfeldt: "Re: simple algorithm for finding primes"
- In reply to: Dan Pop: "Re: K&R-Style Function Declarations: Good or Bad?"
- Next in thread: Dan Pop: "Re: K&R-Style Function Declarations: Good or Bad?"
- Reply: Dan Pop: "Re: K&R-Style Function Declarations: Good or Bad?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 10 Dec 2003 05:15:18 GMT
Dan Pop <Dan.Pop@cern.ch> wrote:
>
> I'm not sure about the behaviour of this code in K&R C, which talks about
> float parameters getting widened to double, but no mention about char and
> short parameters getting promoted to int.
As far as I know, all pre-ANSI compilers widened char and short
arguments to int (even if char was unsigned -- the first hint of
value-preserving conversion rules!). Behavior varied for unsigned char
and unsigned short: some compilers didn't support them at all, most
compilers widened them to unsigned int, a few (or maybe just one) used
ANSI-like value-preserving rules and widened them to either int or
unsigned int depending. Behavior also varied for the parameter
declarations -- some compilers converted the widened types back to the
declared types, other compilers quietly rewrote the parameter
declarations using the widened types (much as array declarations are
quietly rewritten as pointer declarations).
-Larry Jones
That's one of the remarkable things about life. It's never so
bad that it can't get worse. -- Calvin
- Next message: goose: "Re: Convert HEX string to bin"
- Previous message: glen herrmannsfeldt: "Re: simple algorithm for finding primes"
- In reply to: Dan Pop: "Re: K&R-Style Function Declarations: Good or Bad?"
- Next in thread: Dan Pop: "Re: K&R-Style Function Declarations: Good or Bad?"
- Reply: Dan Pop: "Re: K&R-Style Function Declarations: Good or Bad?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|