ephram@violet.berkeley.edu (05/12/89)
Here is what I consider a minor bug with turbo pascal (V.5.0 maybe 4 others
untested). It has to do with comments. The basic problem is with nesting
comments of the same "type", ie { or (*. The code that follows illustrates
some of my gripe.
This is legal in TP5
begin
{{ }
end.
This is illegal in TP5
begin
{{ }}
end.
This is legal in TP5
begin
{ (* }
end.
This is illegal in TP5
begin
{ (* } *) }
end.
And, Finally this is illegal in TP5
begin
{ }}
end.
My point is that there is a lot of inconsistancy in levels of parenthesization
(sp?). It crops up in code every once in a while and can be hard as h*ll to
find. if you forget to close your comment then whole sections of code can be
commented out (usually easy to find :-). Worse yet if you have succesive lines
with comments one line can be commented out and not be easy to notice at all.
begin
writeln ('this program inc''s I and prints it out'); { emit stupid message}
while false do begin {loop forever
inc (i); {do the increment}
writeln (i); {and print it out}
end;
end.
This will print whatever "i" was forever. If that "inc i" step was a
Procedure that called other Procedures etc. You would wonder "what is wrong
with my procedure's?" and be off on a wild goose chase.
My basic point is that I think that TP should check parenthetical levels at
least for the illegal case of {{ }. I suppose that the structure of the
parenthesis would then cause the { char to never be use inside of a comment
but the } char can never be used as such anyway.
What do other people think? is this a bg or a feature to be able to block out
multiple sections of code with only changing some of the {'s?
{ procedure_1;
{ prodecure_2;
{Procedure_3;
}
is afterall a legal construct.
We must prevent those commies from compromising the integrity of our
precious bodily fluids. -Gen. Jack D. Ripper
Ephram Cohen ephram@violet.berkeley.edu
466 44th St. #1 3210 Tolman Hall
Oakland, CA 94609 Berkeley, CA 94720
abcscnuk@csuna.csun.edu (Naoto Kimura) (05/14/89)
In article <24349@agate.BERKELEY.EDU> ephram@violet.berkeley.edu () writes: >Here is what I consider a minor bug with turbo pascal (V.5.0 maybe 4 others >untested). It has to do with comments. The basic problem is with nesting >comments of the same "type", ie { or (*. The code that follows illustrates >some of my gripe. > > ... (examples deleted) ... > >Ephram Cohen ephram@violet.berkeley.edu It isn't a bug... It differentiates between the different types of comments ( {blah} vs (*blah*) ). This feature allows nesting of comments (by using a different type of comment around the other comments. This of course, is highly non-standard (standard says that the two comment types are equivalent, so you can have a comment that looks like {this*) or (*even this} ). Besides, nested comments are non-standard anyway. If you're resorting to commenting out sections of code for some purpose, why not use the conditional compilation feature of Turbo Pascal? //-n-\\ Naoto Kimura _____---=======---_____ (abcscnuk@csuna.csun.edu) ====____\ /.. ..\ /____==== // ---\__O__/--- \\ Enterprise... Surrender or we'll \_\ /_/ send back your *&^$% tribbles !!