# Unable to determine output

Hi,

I am unable to trace the behaviour of my TC compiler when it calculates the following exp :

z=--i*2+--i+--(--i);

z=--i+--(--i)
etc.

Please explain how it calculates these exp.Please give a proper answer I am uninterested in answer like the behaviour is compiler dependent.
Thanks.

• [b][red]This message was edited by stober at 2004-7-31 0:47:20[/red][/b][hr]
: Hi,
:
: I am unable to trace the behaviour of my TC compiler when it calculates the following exp :
:
: z=--i*2+--i+--(--i);
:
: z=--i+--(--i)
: etc.
:
: Please explain how it calculates these exp.Please give a proper answer I am uninterested in answer like the behaviour is compiler dependent.
: Thanks.
:
[blue]That won't compile -- so TC can't calculate the expression.[/blue]

• : [b][red]This message was edited by stober at 2004-7-31 0:47:20[/red][/b][hr]
: : Hi,
: :
: : I am unable to trace the behaviour of my TC compiler when it calculates the following exp :
: :
: : z=--i*2+--i+--(--i);
: :
: : z=--i+--(--i)
: : etc.
: :
: : Please explain how it calculates these exp.Please give a proper answer I am uninterested in answer like the behaviour is compiler dependent.

: : Thanks.
: :
: [blue]That won't compile -- so TC can't calculate the expression.[/blue]
:
:
:

The code written above was actually
int i=20;
int z;
z=(--i)*2+(--i)+(--(--i));

z=(--i)+(--(--i));

It is in compilable state.

• [b][red]This message was edited by stober at 2004-8-7 6:25:59[/red][/b][hr]
:
: The code written above was actually
: int i=20;
: int z;
: z=(--i)*2+(--i)+(--(--i));
:
: z=(--i)+(--(--i));
:
: It is in compilable state.
:
:

[blue]That still won't compile. Why don't you compile it yourself before posting?

This is not valid[/blue]
[code]
(--(--i)) [red]<<< invalid syntax[/red]
[/code]

• : Please explain how it calculates these exp.Please give a proper answer I am uninterested in answer like the behaviour is compiler dependent.
: Thanks.

It shouldn't matter how it's evaluated since you shouldn't be writing such evil expressions in the first place!
• : [b][red]This message was edited by stober at 2004-8-7 6:25:59[/red][/b][hr]
: :
: : The code written above was actually
: : int i=20;
: : int z;
: : z=(--i)*2+(--i)+(--(--i));
: :
: : z=(--i)+(--(--i));
: :
: : It is in compilable state.