[fpc-pascal] Nested comments.

Tomas Hajny XHajT03 at hajny.biz
Sun Jan 21 17:12:05 CET 2024


On 2024-01-21 13:21, Guillermo Martínez Jiménez via fpc-pascal wrote:


Hi,

> I'm wondering if it is possible to make FPC detect and warn (or even
> stop compillation when) it has detect a nested comment.  That's because
> I'm using Vim and it closes odd comments.  For example, the nex code:
> 
> { This comment isn't closed. *)
>   DoSomething ();
> { This is a nested comment. }
> 
> I know this is a silly mistake, but sometimes I comment batchs of codde
> to deactivate them temporary and when un-comment they're non paired and
> it result in weird runtime bugs.
> 
> A command line option that activate that functionality would be great.
> Something like -wn (because -vn is used for notes).
> 
> What do you thing?

Well, I guess that you use mode Delphi, because warning about nested 
comments and even an error in your case (due to nested comment not 
closed) is already issued by default. So the very simple solution is 
using e.g. -Mobjfpc. ;-)

Tomas


More information about the fpc-pascal mailing list