'goto" gone from computer languages or is it!

Bryan Pope bpope at wordstock.com
Fri May 13 13:28:27 CDT 2005


And thusly Sean 'Captain Napalm' Conner spake:
> 
> It was thus said that the Great Bryan Pope once stated:
> > 
> > And thusly Mike Loewen spake:
> > > 
> > > On Fri, 13 May 2005, Bryan Pope wrote:
> > > 
> > > >>   So, to tie this in with the Zen Koan threads, what is the result of
> > > >>
> > > >> 	int i = 0;
> > > >> 	printf("%d %d %d\n",i++,i++,i++);
> > > >>
> > > >
> > > > IIRC it should output:
> > > >
> > > > 2 1 0
> > > 
> > >     Not on my system:
> > > 
> > > 0 1 2
> > > 
> > 
> > I checked after I sent the message and my system output "2 1 0"...  I am 
> > using Watcom C 10.6 under QNX 4.25.
> 
> I was replying to this statement from John Hogerhuis:
> 
> > I think the programming language is the most
> > succinct, clear, and unambiguous specification language imaginable.
> > Almost always each construct has one and only one interpretation. 
> 
>   And this is a perfect example of what I was trying to get across (and so
> far, no one has stated the correct answer, yet both Bryan's and Mike's
> compilers have produced a correct answer.  To add fuel to the conversation,
> the IRIX 4.0.5 C compiler would produce
> 
> 	0 0 0
> 
> which is also a correct answer.
> 

Now I am going to have to find my K & R book...  I believe it says that 
the order for a printf it right to left and since the "++" is after the 
variable, the increment gets done after the value of retrieved.

Cheers,

Bryan Pope



More information about the cctalk mailing list