Subject: Re: Bluetooth protocol code
To: Iain Hibbert <firstname.lastname@example.org>
From: Bill Studenmund <email@example.com>
Date: 12/19/2005 11:52:22
Content-Type: text/plain; charset=us-ascii
On Mon, Dec 12, 2005 at 10:22:26PM +0000, Iain Hibbert wrote:
> On Mon, 12 Dec 2005, Rui Paulo wrote:
> > On 2005.12.08 00:55:26 +0000, Iain Hibbert wrote:
> > |
> > | so, like I say - any comments welcomed.. this is not the end, or eve=
> > | beginning of the end but its getting near the end of the beginning..
> > Style:
> > 1) please use ANSI function declarations;
> on all functions? (grumble grumble..)
I realize you got a lot of response to this and that I'm a bit late. But=20
yes, this point is important.
The problem is that K&R prototypes won't work right if we pass in a=20
parameter that's larger than an int. Like a long or a pointer on an LP64=20
In such a case, the caller will turn the parameter into an int, truncating=
it. Worse yet, the caller will then pack other parameters in, not leaving=
enough space for what the caller will expect the parameter to be. Thus the=
callee will see two parameters mixed together in what it thinks is one=20
parameter (by our style guide, it will get the parameters right), and a=20
parameter at the end will be totally uninitialized.
This behavior is why we're moving away from K&R parameters & prototypes.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)
-----END PGP SIGNATURE-----