What are the platform values?

I am using DebugHook and the compiler warns me that it is

specific to a platform.

When I look at its definition in the System unit, I see

 DebugHook: Byte platform = 0; 
  • I want the code to work for most platforms.

  • I am guessing that DebugHook is only valid for MSWINDOWS.

  • But, what are the values of the platform “attribute” ?

2nd part of it is that I would like to turn off the warning for that particular line of code. I see in previous posts that someone said the granularity is a method? Is this correct

There’s no attribute, it’s a catch-all:

https://docwiki.embarcadero.com/RADStudio/Athens/en/Declarations_and_Statements_(Delphi)#Hinting_Directives

  {$WARN SYMBOL_PLATFORM OFF}
  if DebugHook > 0 then
    // Whatever you're doing when debugging
  {$WARN SYMBOL_PLATFORM ON}

I had tried it but must have miscopied from somewhere and was using UNIT_PLATFORM OFF, which didn’t work. This works fine, thanks. My goal is to have 0 warnings, then the real ones that matter will catch my eye.

As implemented it is pointless.

Looking at other values, Its probably a bit mask. Deciphering it may help in determining which platform(s) it does or doesn’t work with.

There’s nothing much to decipher; as documented, it is always warning, regardless of actual target platform.

My misunderstanding.

DebugHook: Byte platform = 0; 

For some minutes I took =0 to be a value for platform. It is instead the value for DebugHook.:rofl:

1 Like