Recent

Author Topic: What is {%H-} (note % instead of $) ?  (Read 8237 times)

Zoran

  • Hero Member
  • *****
  • Posts: 1980
    • http://wiki.lazarus.freepascal.org/User:Zoran
What is {%H-} (note % instead of $) ?
« on: March 05, 2016, 12:22:02 pm »
This {%H-} can be found in function declarations in Lazarus source - it seems to me like it tells to compiler "hints off", but it does not start with $, but with %, so what is it?

Is there "%" style of compiler directives?

I tried to search fpc docs, but didn't find anything about some % directives. Is it documented anywhere? If it is, I apologize, I could not find it.
Searching forum for %H gives every post containing letter H, so you just cannot search for %H.  %)
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1071
Re: What is {%H-} (note % instead of $) ?
« Reply #1 on: March 05, 2016, 12:24:08 pm »
The compiler sees it like any other comment and hence ignores it. The Lazarus IDE recognises it though, and if encountered it filters any hints that the compiler generates for the particular location in the source code.

Zoran

  • Hero Member
  • *****
  • Posts: 1980
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: What is {%H-} (note % instead of $) ?
« Reply #2 on: March 05, 2016, 12:25:11 pm »
The compiler sees it like any other comment and hence ignores it. The Lazarus IDE recognises it though, and if encountered it filters any hints that the compiler generates for the particular location in the source code.

Thank you!
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: What is {%H-} (note % instead of $) ?
« Reply #3 on: March 05, 2016, 01:01:21 pm »
The Lazarus IDE has introduced several comment conventions that are not part of FPC's Object Pascal syntax, so the compiler is completely ignorant of them, and FPC documentation likewise knows nothing about them.

For instance there is also the useful
{%region}
...
{%endregion}
which enables you to fold away arbitrary sections of code,
and {#todo ...}
which allows you to maintain a simple ToDo list.

Zoran

  • Hero Member
  • *****
  • Posts: 1980
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: What is {%H-} (note % instead of $) ?
« Reply #4 on: March 05, 2016, 01:13:29 pm »
The Lazarus IDE has introduced several comment conventions that are not part of FPC's Object Pascal syntax, so the compiler is completely ignorant of them, and FPC documentation likewise knows nothing about them.

For instance there is also the useful
{%region}
...
{%endregion}
which enables you to fold away arbitrary sections of code,
and {#todo ...}
which allows you to maintain a simple ToDo list.

Thanks, Howard,
Now I finally found it in the wiki: http://wiki.freepascal.org/IDE_directives
Searching wiki for "endregion" brought me this page. It was impossible to search for "%H". :)
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

balazsszekely

  • Guest
Re: What is {%H-} (note % instead of $) ?
« Reply #5 on: March 05, 2016, 01:43:12 pm »
This is interesting, I wasn't aware that {%region}{%endregion}also works. I always used the {$Region}{$EndRegion} combination, which by the way is not available in D2007, it was introduced much later in one of the XE version(if I remember correctly).

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: What is {%H-} (note % instead of $) ?
« Reply #6 on: March 17, 2016, 08:23:00 pm »
I always used the {$Region}{$EndRegion} combination,
Yes that is my preferred use also I find the % symbol to unpleasant for use.
which by the way is not available in D2007, it was introduced much later in one of the XE version(if I remember correctly).
Yes it is, region and code folding was introduced in D2005 along with the Delphi .NET compiler
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

balazsszekely

  • Guest
Re: What is {%H-} (note % instead of $) ?
« Reply #7 on: March 17, 2016, 08:56:37 pm »
Quote
Yes it is, region and code folding was introduced in D2005 along with the Delphi .NET compiler
True, it works with D2007(just tested)! 

 

TinyPortal © 2005-2018