[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: [LI] j = ++i * ++i * ++i : A long reply..BEWARE



Hi Shourya,

You are right about the gcc stuff on Solaris and Linux. They should not
give different results, unless there has been a major version change -
a change in the parse algorithm for the programs, maybe ?? I can
only lay my hands on Solaris cc, so dunno much about gcc counterpart.

I checked the case 2, you have mentioned. It seems the brackets are
ignored while parsing that statement. Sorry for the mistake. The main 
idea was to show how the parser may interpret the statements in the
various cases. I am always bad at explaining things :-( - The said
statement would give 6*6*6 on Solaris cc again.

The classical example of cryptic programming was the morse-code.

var = --o-o---o---o---o--;( And it can go on. BTW, o is an integer ;-) )

Suvendra


Date: Tue, 18 Jan 2000 22:59:13 -0500
From: Shourya Sarcar <sarcar@xxxxxxxx>
Subject: [LI] j = ++i * ++i * ++i : A long reply..BEWARE

	f) Suvendra , you snatched the words from my mouth about the
interviewers. Thanks, you couldn't have been more correct. You have done 
agreat job in explaining as far as possible the hows, do's and dont-s behind

the problem. But your explanation of case 2 :
	
	 	Case 2: (++i)*(++i)*(++i) 4*5*6

	will not compile to give 120 under Linux/gcc (I used version 2.91).
It
will give you 150.

--------------------------------------------------------------------
The Linux India Mailing List Archives are now available.  Please search
the archive at http://lists.linux-india.org/ before posting your question
to avoid repetition and save bandwidth.