Re: [Lazarus] $IF for Linux and FreeBSD platforms?
Am 28.02.2017 20:37 schrieb "Lars via Lazarus" < lazarus@lists.lazarus-ide.org>: > > On 2017-02-16 05:35, Graeme Geldenhuys via Lazarus wrote: >> >> On 2017-02-16 11:18, Ondrej Pokorny via Lazarus wrote: >>> >>> Well, you mixed up DEFINED and DECLARED macros. >> >> > > Sorry newbie question regarding these $IF directives: > > can someone explain why you would use "$IF defined" instead of $IFDEF... > > Obviously there are likely reasons for using one over the other. $IFDEF FOO is an abbreviation for $IF DEFINED(FOO). The latter also allows to combine multiple checks using AND and OR (and also allowing comparisons with constant values) while the former can always only check for a single define. Regards, Sven -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] $IF for Linux and FreeBSD platforms?
On 2017-02-28 19:37, Lars via Lazarus wrote: > can someone explain why you would use "$IF defined" instead of $IFDEF... In that case a piece of code applied to both Linux and FreeBSD platforms. I didn't see the need to duplicate the code with IFDEF statements - thus making code management more work. So use "$IF defined" to accept more that one define for a block of code. >> Dope!!! Thanks for spotting that. I need more coffee. ;-) > > Coffee being used as a crutch is bad. Use it for an extra burst, not as > an hourly/daily reliance. I live on coffee and Red Bull at the moment. Trying to survive lots of sleepless nights due to a little human teething! :-( Or how does the other saying go: Computer Programmer: We convert coffee and pizza into source code. :-) Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] $IF for Linux and FreeBSD platforms?
On 2017-02-16 05:35, Graeme Geldenhuys via Lazarus wrote: On 2017-02-16 11:18, Ondrej Pokorny via Lazarus wrote: Well, you mixed up DEFINED and DECLARED macros. Sorry newbie question regarding these $IF directives: can someone explain why you would use "$IF defined" instead of $IFDEF... Obviously there are likely reasons for using one over the other. Dope!!! Thanks for spotting that. I need more coffee. ;-) Coffee being used as a crutch is bad. Use it for an extra burst, not as an hourly/daily reliance. IMHO Or IMAO A := 'arrogant'; -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] $IF for Linux and FreeBSD platforms?
On 2017-02-16 11:18, Ondrej Pokorny via Lazarus wrote: > Well, you mixed up DEFINED and DECLARED macros. Dope!!! Thanks for spotting that. I need more coffee. ;-) Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] $IF for Linux and FreeBSD platforms?
On 16.02.2017 12:16, Graeme Geldenhuys via Lazarus wrote: On 2017-02-16 10:54, Graeme Geldenhuys via Lazarus wrote: The IDE shows that CodeTools knows about the FreeBSD variable, but the code doesn't seem to work, Doing the following though does work, but it means I have to duplicate all $DEFINE lines in two places, which I don't really want to do. {$IFDEF LCLGTK2} {$IFDEF Linux} {$DEFINE something} ...snip. {$ENDIF} {$IFDEF FreeBSD} {$DEFINE something} ...snip. {$ENDIF} {$ENDIF} Well, you mixed up DEFINED and DECLARED macros. The following should work: {$IFDEF LCLGTK2} {$IF DEFINED(Linux) or DEFINED(FreeBSD)} {$define something} {$endif} {$endif} Ondrej -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] $IF for Linux and FreeBSD platforms?
On 2017-02-16 10:54, Graeme Geldenhuys via Lazarus wrote: > The IDE shows that CodeTools knows about the FreeBSD variable, but the > code doesn't seem to work, Doing the following though does work, but it means I have to duplicate all $DEFINE lines in two places, which I don't really want to do. {$IFDEF LCLGTK2} {$IFDEF Linux} {$DEFINE something} ...snip. {$ENDIF} {$IFDEF FreeBSD} {$DEFINE something} ...snip. {$ENDIF} {$ENDIF} Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp -- ___ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus