Home » Community » Coffee corner » important note when a strange compilation error occurs
Re: important note when a strange compilation error occurs [message #57298 is a reply to message #57297] |
Sun, 27 June 2021 17:49   |
 |
Klugier
Messages: 1099 Registered: September 2012 Location: Poland, Kraków
|
Senior Contributor |
|
|
Hello,
According to the standard following line is valid code:
You are opening function scope and add empty instruction. Please noticed that you can place whatever number of semicolons as you want:
void getTiposCartao(){;;;;;;; // <- valid
Why it is so? In C/C++ you are not force to write instruction per line - it is good habbit, but you have flexibility:
void getTiposCartao(){int a = 4;++a;int b = a + 10;for(int i = 0; i < 10; ++i){};;;} // <- You could process universe in the single function ;)
For the readability reason nobody should write code like this... This is not something we could fix within TheIDE. It is how the language is defined.
On the other hand following code:
is invalid due to parenthesis mismatch.
Klugier
U++ - one framework to rule them all.
[Updated on: Sun, 27 June 2021 17:52] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Wed May 14 06:20:27 CEST 2025
Total time taken to generate the page: 0.03178 seconds
|