How can you get a while loop inside an if statement to compile
I am trying to optimize code so that the embedded system runs faster. Here is my question:
Can someone explain to me why this doesn't compile.
Here the while loop is simply introducing a delay. "delay" is actually a complicated function that eventually returns 0. The details of this is irrelevant. Notice i didn't put any bracket near the while loop or any semicolon but instead i put a comma (because i'm inside an "if" statement, i cannot use a semicolon). We know that the result of the comma separated list is the last element of the list. The result of the argument of the if statement is B. While this doesn't compile, i can create a function that is equivalent:
B = 1;
The latter will compile but i want to avoid a function call because that adds overhead. My ultimate goal is to optimize the code. Why is the function call compiling and not the earlier code. What can i do to make it compile without using a function call? A "for" loop doesn't work either and i cannot use goto statements. I don't want to use machine code at this time unless i don't have a choice. My compiler doesn't allow "inline" functions. Is this even possible?
B = 1;
Then i can do the following: