Path: utzoo!utgpu!water!watmath!clyde!rutgers!rochester!cornell!batcomputer!pyramid!markhall From: markhall@pyramid.pyramid.com (Mark Hall) Newsgroups: comp.lang.c Subject: nested comments Summary: why not? Message-ID: <13423@pyramid.pyramid.com> Date: 19 Jan 88 21:14:33 GMT Reply-To: markhall@pyramid.UUCP (Mark Hall) Organization: Pyramid Technology Corp., Mountain View, CA Lines: 40 I have a brief observation about comment operators, which applies to C as well as other languages. Rather than suggest that it be incorporated into ANSI C, I would only like to hear your views, and either (a) build up some ground swell of support, or (b) discover why it is a bad idea. If it has been discussed before, please refer me to the article numbers. I would like to give two short arguments for having nested comments. 1. it is often convenient to `comment-out' code that already has comments in it, either because you don't want to RUN the code, or because you don't want to COMPILE the code. If you don't want to run the code, you can encircling it like: if (FALSE) { . . . offending code with comments . . . } but this means that the `offending code' must be syntactically correct, or the compiler will not produce an executable (even though the code cannot be executed), so we cannot use this method when we don't want to compile the offending code. (Note that having nested comments here would aid appreciably in performing the `binary bug hunt'.) 2. using nested comments, you are much less likely to suffer from mistakes of the form: a=b; /* <-- comment starts here c=d; /* comment ends here --> */ The compiler would, in all likelyhood, run til EOF looking for the matching comment and, since it knows which begin-comment it is trying to match, could point back to the offending comment above and report ``no close comment found matching this fellow''. Please send useful comments to: {seismo|sun|decwrl|hplabs|lll-lcc|ut-sally|amdahl}!pyramid!markhall flames to: /dev/null ******* Mark Hall - #include