Why nested comments not allowed?

Martin Weitzel martin at mwtech.UUCP
Thu Feb 22 01:35:20 AEST 1990


In article <236100027 at prism> ly at prism.TMC.COM writes:
>
>	I'm just curious to know why nested comments are not allowed in many 
>	languages.

While other posters showed, that forbidding nested comments is
no *disadvantage* because of C-s "#if-#endif" capability, here's
a reasons why non-nested comments could be considered to be an
advantage:

	................... <--- 100 lines of C-Code
	/* here is some comment */
	................... <--- some statement
	................... <--- another 100 lines of C-Code

If this source compiles without errors and nested comments *were*
allowed, I could never be sure that the compiler had really seen
the marked statement after the comment without checking the source
before and after it for enclosing comments. The only thing which
is still of importance are conditionaly compiled sections, which
are far easier to track because in the average programm they appear
far less than comments.
-- 
Martin Weitzel, email: martin at mwtech.UUCP, voice: 49-(0)6151-6 56 83
-- 
Martin Weitzel, email: martin at mwtech.UUCP, voice: 49-(0)6151-6 56 83



More information about the Comp.lang.c mailing list