segmentation fault

Gale Paeper gpaeper at empirenet.com
Thu Dec 23 13:23:44 CET 2004


Frank Heckenbach wrote:
> 
> Gale Paeper wrote:
> 
> > At least according to the documentation, none of the MacPascal dialect
> > compilers allow nested comments in the `{ ... { ... } ... }' form.
> > CodeWarrior Pascal and MPW Pascal compilers support a nest comments
> > Pascal non-standard extension but you must use different comment
> > delimiters for nesting; e.g. '{ ... (* ... *) ... }'.
> 
> Are these really nested comments, or are `(*' and `*)' just ignored
> within a `{ ... }' comment? In the latter case, also `{ (* }' and
> `{ *) }' would be comments. This (requiring matching delimiters)
> would be the behaviour of most compilers I've seen (including GPC in
> non-standard modes).
> 

After some quickie blackbox compiler behavior checking, it doesn't
appear that any of the MacPascal dialect compilers support what would be
true nested comments although the documentation uses the term "nested"
to describe the supported comment forms.  What testing indicates is
implemented in CodeWarrior Pascal, MPW Pascal, and THINK Pascal
compilers is (to use THINK Pascal's documentation description):

{ Any text not containing right-brace }
(* Any text not containing star-right-paren *)

which, if I've understood your comment correctly, is another way of
describing your "latter case".  The begin-comment and end-comment
delimiters must use the same comment style form to form a legal closed comment.

In case it helps in understanding, some of the constructs tested which
formed accepted/legal comments:

{ (* }
{ *) }

and unaccepted/illegal constructs with problem notations:

{ ... (* ... { ... } ... *) ... } illegal - error after first '}'
{ ... (* ... } ... *) illegal - error after '}'
{ ... *) Non-matching begin-comment and end-comment delimiters don't
form a closed comment
{ ... (* ... *) ... *) Non-matching begin-comment and end-comment
delimiters don't form a closed comment

Note:  For the unaccepted/illegal constructs, errors were reported. 
However, the reported errors weren't indicative of a malformed comment -
just some sort of non-comment related illegal program construct.  For
example, the last two unclosed comment test cases resulted in illegal
statement errors at the end of the file for the simple test program I
was using.

Gale Paeper
gpaeper at empirenet.com




More information about the Gpc mailing list