Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: $Revision: 1.6.2.13 $; site iuvax.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxj!ihnp4!inuxc!iuvax!apratt From: apratt@iuvax.UUCP Newsgroups: net.lang.c Subject: Re: Unterminated comments Message-ID: <9500012@iuvax.UUCP> Date: Tue, 30-Oct-84 15:56:00 EST Article-I.D.: iuvax.9500012 Posted: Tue Oct 30 15:56:00 1984 Date-Received: Wed, 31-Oct-84 06:13:10 EST References: <13094@sri-arpa.UUCP> Lines: 54 Nf-ID: #R:sri-arpa:-1309400:iuvax:9500012:000:1218 Nf-From: iuvax!apratt Oct 30 15:56:00 1984 I think it's clear, when you look again, that the original writer meant that a program: main() { printf("Hello!"); /* This is an unclosed comment printf("Goodbye!); } should produce the error message, "Unclosed comment starting at line 3." The same error should be generated for this program: main() { /* * This program does almost nothing * printf("Hello!"); printf("Goodbye!"); } (the key word is STARTING at line xx. There's no way of knowing when the comment was intended to end and the code starts.) The issue of nested comments is also interesting: time and again I have wanted to "comment off" code like this: main() ... /* fn1(x,y) /* real version */ { ... } */ fn1(x,y) /* test version */ { ... } But the end-comment after "real version" would close the enclosing comment. The accepted way to do this, of course, is with #if 0 ... #endif, but I prefer the nested-comment option stylistically. The Lattice C compiler for the IBM PC has a nested-comment feature, which can be turned OFF with a switch on the command line. Very handy, I think. In the UNIX environment, of course, this kind of thing would be turned ON with a switch. ---- -- Allan Pratt ...ihnp4!inuxc!iuvax!apratt