Why nested comments not allowed?

Mike McNelly mike at hpfcso.HP.COM
Fri Feb 16 03:40:17 AEST 1990


	> I'm just curious to know why nested comments are not allowed in many 
	> languages.

1.  They have limited usefulness.  For most of the occasions where they
are useful, conditional compilation seems to work better.  In C, for
example,

	# if condition1
	...
	#	 if condition2
	...
	#	 endif
	...
	# endif 

seems to fill the void (pardon the pun) pretty well for me.

2.  For those languages with the concept of lines, I find end-of-line
comments to be the least bug inducing form.  Incorrectly terminated
comment blocks, whether in a language that supports comment nesting or
not, seem to be a great source of bugs.  Note that I am NOT saying that
I prefer line oriented languages.

I guess it's pretty much a matter of personal preference on the part of
the language designers.

Mike McNelly
mike%hpfcla at hplabs.hp.com



More information about the Comp.lang.c mailing list