barrym95838 wrote:
I'm not a great C programmer, but FWIW I can vouch for rwiker's description of the semicolon issue. White space, including line breaks (or the lack thereof) carry far less importance than semicolons in C and C++ source, allowing some misleading or confusing constructions at first glance (or even second glance), because many of us as humans have a tendency to see them as being in the same "ball park" of significance. In my experience, most assemblers tend to share that view. Most C compilers certainly do not.
Mike B.
Whitespace is largely ignored in C. If you look at examples of obfuscated C programs they are often have either minimal whitespace and most of the code is on very long lines, or they use lots of redundant whitespace to format the code into an interesting shape.
http://www.ioccc.org/2015/burton/prog.cYou could rewrite the strcpy example as ...
Code:
void strcpy(char*d,char*s){while(*d++=*s++);}
... and it would still work. The only mandatory whitespace in this example is between the return type and the function name.
The C grammar defines an 'expression-statement' as and optional 'expression' followed by a semicolon. A 'while' statement is defined as 'while ( expression ) statement' where 'statement' expands into a choice of several types of statement including the 'expression-statement'.