if statements in C++

I am trying to shorten my code so I just tested this snippet of code as an alternative to using the "standard if/else statement.
The code executes correctly so it appears the syntax is valid.
However, it takes a long time to compile.

int a = HIGH;
int b = LOW;
bool c;
bool d;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  while(!Serial);

  if (a == b) c = true;
  else c = false;
  Serial.println(c);

  d = (a == HIGH) ? true : false;
  Serial.println(d);
}

void loop() {
  // put your main code here, to run repeatedly:

}

Just wondering if there are any known issues using the above if statements.

if (a == b) c = true;
  else c = false;

Aka

c = a==b;

AWOL:

if (a == b) c = true;

else c = false;




Aka



c = a==b;

Nice one, I will try to remember that.
For my test I used true/false to keep it simple, but in my code different values are assigned.

However, it takes a long time to compile.

It took less than 10 seconds when I compiled it. Since you didn't mention which Arduino, which version of the IDE, or which OS, I won't, either.

PaulS:
It took less than 10 seconds when I compiled it. Since you didn't mention which Arduino, which version of the IDE, or which OS, I won't, either.

lol PaulS from reading so many of your posts, I can appreciate your sometimes twisted sense of humour.

FWIW IDE 1.6.5 r2, Windows 7 Professional, Uno.
Compiled again - this time it took 22 seconds. Before definitely more than at least 30 seconds.

1.0.5, Win 7 (16G memory), Micro - less than 10 seconds.