Sign in Join

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

Mailing lists / fpc-pascal / 2009-09

$IF documentation - missing help

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

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

Graeme Geldenhuys

Hi,

Where is the extended $IF directive documented. The prog.pdf has 2 paragraphs on $if and then referes you to the "conditionals" section. But the Conditionals section is incomplete.

I look through all these docs...
prog.pdf ref.pdf user.pdf

What I am looking for is something I used years ago, but can't find an example of it now. I can't remember the exact syntax, but is was something like this:

{$IFDEF FPC $IF Defined(VER2_3) or ....)
  ...
{$ENDIF}

Due to the mishaps with UnicodeString in FPC 2.3.1, I need to IFDEF some tiOPF code so that certain code will only work with FPC 2.2.5 and earlier, and other code will only work with FPC 2.3.1 and greater. How do I write this?

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Aleksa Todorovic
to Graeme Geldenhuys

Maybe

{$IF Defined(VER2_3) or Defined(VER2_4))
 ...
{$ENDIF}

?

Graeme Geldenhuys wrote 34 lines
Hi, Where is the extended $IF directive documented. The prog.pdf has 2 paragraphs on $if and then referes you to the "conditionals" section. But the Conditionals section is incomplete. I look through all these docs... prog.pdf  ref.pdf  user.pdf What I am looking for is something I used years ago, but can't find an example of it now. I can't remember the exact syntax, but is was something like this: {$IFDEF FPC $IF Defined(VER2_3) or ....)  ... {$ENDIF} Due to the mishaps with UnicodeString in FPC 2.3.1, I need to IFDEF some tiOPF code so that certain code will only work with FPC 2.2.5 and earlier, and other code will only work with FPC 2.3.1 and greater. How do I write this? Regards,  - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/ _______________________________________________ fpc-pascal maillist  -   http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Aleksa Todorovic - Lead Programmer Eipix Entertainment http://www.eipix.com/

Reply by email

Marco van de Voort
to Aleksa Todorovic

In our previous episode, Aleksa Todorovic said:

Show quoted text 5 lines
Maybe {$IF Defined(VER2_3) or Defined(VER2_4)) ?... {$ENDIF}

How to do this depends on how far back you want to support (1.0.x don't even support $IF), and far into the future.

Afaik FULL_VERSION was introduced in either 2.2.2 or 2.2.4 to fix at least the future proof part. If you discount 2.2.0 (and maybe 2.2.2 too, since the fix was made a few days before 2.2.2 came out and might not be merged) you could try:

  {$if FPC_FULLVERSION>=20300}  //2.3.4 would be encoded as 020304
  {$endif}

Reply by email

Graeme Geldenhuys
to Marco van de Voort

Marco van de Voort het geskryf:

How to do this depends on how far back you want to support (1.0.x don't even support $IF), and far into the future.

FPC is free, so I only support up to the previous release. There should be no excuse not to upgrade (this is very different from Delphi). tiOPF support Delphi all the way back to D7. I don't do that for FPC.

Afaik FULL_VERSION was introduced in either 2.2.2 or 2.2.4 to fix at least

^^^^^^^^^^^^ should be FPC_FULLVERSION.

------------------------------
$ git log --grep="FPC_FULLVERSION"
commit 05a4a0dadd7d712709d35129345bd06ede45e645
Author: Florian Klaempfl
Date: Sun Aug 3 09:31:50 2008 +0000

+ defined FPC_FULLVERSION as integer constant containing the version, release and patch level are always two digits so the version can be compared numerically: so 2.2.2 results in 20202, resolves #11568

git-svn-id:
3ad0048d-3df
------------------------------

I'm not sure what release version that was (r11504).

{$if FPC_FULLVERSION>=20300} //2.3.4 would be encoded as 020304

Excellent, your example is going to work better than VER2_3 or VER2_4 because it will still apply for FPC 2.5 etc...

Luckily I looked this up in the prog.pdf, even though I don't have $MACROS ON defined, the compiler for some reason never complained about my usage of FPC_FULLVERSION. Umm, I wonder if this is a bug, or if the docs are wrong (section 2.2 in prog.pdf)?

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email