Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!swrinde!ucsd!ucbvax!agate!shelby!unix!hplabs!hp-ses!hpcuhb!hpcllla!hpcllak!shoe From: shoe@hpcllak.HP.COM (Jim "Shoe" Schumacher) Newsgroups: comp.lang.c Subject: Re: Re^2: Why nested comments not allowed? Message-ID: <7330017@hpcllak.HP.COM> Date: 17 Feb 90 03:15:12 GMT References: <236100027@prism> Organization: Hewlett Packard Calif. Language Lab Lines: 39 >ly@prism.TMC.COM / 8:21 am Feb 14, 1990 / > > I'm just curious to know why nested comments are not allowed in many > languages. >---------- You can have some subtle errors with nested comments. ____ { this was a real **{??/ to write and ..... <- start of nesting } <- rest of the file is ignored while we search for the matching brace and the compiler ends up giving you some really strange error message about unexpected eof. You go through your code and can't figure out what it's complaining about. ____ When nesting is allowed you can no longer place any characters you want in your comments since your text is being scrutinized by the compiler. The need to nest comments usually arises when you want to comment out a section of code that contains comments. A better way to do this is to use a compiler directive like #ifdef. ------ #ifdef 0 code with comments.... #endif jim shoe (shoe@hpda)