Page 1 of 1

NXC: a<b? c: d // ==>> compiler error

Posted: 04 Feb 2011, 21:30
by HaWe
hi,
I'm getting a compiler error with this line:

Code: Select all

int SoundLevel, BGrndNoise, p;
SoundLevel<BGrndNoise ? p++ : p=0;
# Error: Invalid assignment
File "c:\Temp\temp.nxc" ; line 43
# SoundLevel<B
#----------------------------------------------------------
# Error: ';' expected
File "c:\Temp\temp.nxc" ; line 43
# SoundLevel<B
#----------------------------------------------------------
what may be wrong (Bricxcc 3.3.8.9. 2010-11-03)

Re: NXC: a<b? c: d // ==>> compiler error

Posted: 04 Feb 2011, 22:17
by afanofosc
Seems like this is not a supported form of the ?: expression as I implemented it in NXC. Try this instead:

Code: Select all

  p = SoundLevel<BGrndNoise ? p+1 : 0;
John Hansen

Re: NXC: a<b? c: d // ==>> compiler error

Posted: 04 Feb 2011, 22:30
by HaWe
thx, this works :)