Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2024-01

Nested comments.

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Guillermo Martínez Jiménez

Hi Pascaloids,

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?

Guillermo "Ñuño" Martínez.
Piopio Juegos.

Tomas Hajny
to Guillermo Martínez Jiménez

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

Hi,

Show quoted text 16 lines
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

Adriaan van Os
to Guillermo Martínez Jiménez: I'm wondering if it is possible to make FPC detect and warn (or even stop compillation…
Guillermo Martínez Jiménez wrote 16 lines
Hi Pascaloids, 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).

($modeswitch nestedcomments-}

Regards,

Adriaan van Os

Guillermo Martínez Jiménez
to Tomas Hajny: Well, I guess that you use mode Delphi, because warning about nested comments and even an…
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. ;-)

That's it: I'm using Delphi mode because code should work both Delphi and FreePascal.

Thanks for the note.

Guillermo Martínez J.