Subject: Re: example for k&r being bad (was: Re: Bluetooth protocol code)
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Hubert Feyrer <feyrer@cs.stevens.edu>
List: tech-userlevel
Date: 12/20/2005 07:40:07
On Tue, 20 Dec 2005, der Mouse wrote:
> int pr(x,y)
> long int x;
> int y;
> {
> printf("%ld %d\n",x,y);
> }
>
> int main(ac,av)
> int ac;
> char **av;
> {
> pr(1,2);
> return(0);
> }
>
> Under IL32 or IL64 (actually, when int and long are the same as far as
> argument passing goes), this "works"; when long occupies more
> argument-list space than int, you get brokenness - probably either
> 4294967298 or 8589934593, followed by a "random" value that generally
> comes from uninitialized stack trash.

output on i386:  1 2
output on alpha: 1 2

Next try? :)


  - Hubert