On Wed, Apr 09, 2014 at 03:46:20PM -0400, Dave Tweed wrote: > Byron Jeff wrote: > > On Wed, Apr 09, 2014 at 01:19:18PM -0400, Dave Tweed wrote: > > > Byron Jeff wrote: > > > > I remember the separator/terminator difference from Pascal. Used to= drive > > > > me nuts. Reason is the inconsistency. Terminators, while annoying, = are > > > > consistent. > > >=20 > > > Technically, the semicolon is a statement *seaparator* in C, too. > >=20 > > Nope. This is not correct. You can see the difference when you have one > > statement in a block and more that one. >=20 > Yes, it is correct. Dave, trust me that it's not. >=20 > > In C (one statement): > >=20 > > if (test) > > i =3D 1; >=20 > Which could also be written: >=20 > if (test) i =3D 1; The newline is not relevant. It's precisely why the semicolon is required. >=20 > > In C (more than one statement): > >=20 > > if (test) { > > i =3D 1; > > j =3D 2; > > } >=20 > Which could also be written: >=20 > if (test) { > i =3D 1; > j =3D 2 > } It cannot. This program: main() { int i,j; if (1) { i =3D 1; j =3D 2 } } Generates these error: testme.c: In function main: testme.c:8:4: error: expected ; before } token make: *** [testme] Error 1 >=20 > or even: >=20 > if (test) { i =3D 1; j =3D 2 } Again this will fail with an error. It would be valid if coded in Pascal. >=20 > All of this is possible becuase ';' is a separator, not a terminator. It is not. Sorry to break the news to you. >=20 > In your example, the compound statement (inside the braces) has three > statments, the third of which is null. In both of my examples, it has > just two statements. As I said in my other post, there is no null statement in my example. >=20 > Of course, we all write compound statements in the style of your example, > and we don't need to worry about adding or removing that last semicolon > specifically because C allows null statements. Null statements have nothing to do with this. The compiler backs me up on this. >=20 > End-of-line has no significance whatsoever in the syntax of C. It's just > whitespace. However, EOL *is* significant in preprocessor statements and > in C++ style '//' comments. >=20 Not relevant to the discussion as the preprocessor is not a part of the language specification proper. BAJ > -- Dave Tweed > --=20 > http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist --=20 Byron A. Jeff Chair: Department of Computer Science and Information Technology College of Information and Mathematical Sciences Clayton State University http://faculty.clayton.edu/bjeff --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .