Thanks
"Alex" <arod...@narod.ru> wrote in message
news:3f15a8d4$1...@newsgroups.borland.com...
"Alex" <arod...@narod.ru> wrote in message
news:3f15a8d4$1...@newsgroups.borland.com...
>
That is making it too simple! <g>
How do you define "Delph5+" ?
{$IFDEF VER130} // delphi 5
{$DEFINE Dephi5Plus}
{$ENDIF}
{$IFDEF VER140} // delphi 6
{$DEFINE Dephi5Plus}
{$ENDIF}
{$IFDEF VER150} // delphi 7
{$DEFINE Dephi5Plus}
{$ENDIF}
Thanks,
Brett
"John Herbster (TeamB)" <herb-sci1_at_sbcglobal.net> wrote in message
news:3f15cafc$1...@newsgroups.borland.com...
{$IFDEF VER80}
{$DEFINE DELPHI_1}
{$DEFINE DELPHI_1_OR_2}
{$ELSE}
{$IFDEF VER90}
{$DEFINE DELPHI_2}
{$DEFINE DELPHI_1_OR_2}
{$ELSE}
{$IFDEF VER100}
{$DEFINE DELPHI_3}
{$ELSE}
{$DEFINE DELPHI_4_OR_LATER}
{$IFDEF VER120}
{$DEFINE DELPHI_4}
{$ELSE}
{$DEFINE DELPHI_5_OR_LATER}
{$IFDEF VER130}
{$DEFINE DELPHI_5}
{$ELSE}
{$DEFINE DELPHI_6_OR_LATER}
{$IFDEF VER140}
{$DEFINE DELPHI_6}
{$ELSE}
{$DEFINE DELPHI_7_OR_LATER}
{$IFDEF VER150}
{$DEFINE DELPHI_7}
{$ELSE}
{$DEFINE DELPHI_8_OR_LATER}
{$ENDIF}
{$ENDIF}
{$ENDIF}
{$ENDIF}
{$ENDIF}
{$ENDIF}
{$ENDIF}
Mike O'Hanlon
Regards, Maël.
"Alex" <arod...@narod.ru> schrieb im Newsbeitrag
news:3f15a8d4$1...@newsgroups.borland.com...
Brett, I was wishing for a way that would not require
modification of the source when Delphi8 came out.
I knew that I was difficult. It *is* possible to define
Delphi3Minus, Delphi4Minus, etc. It would be nice if
we could do greater-than and less-than test on "defines".
Rgds, JohnH
"John Herbster (TeamB)" <herb-sci1_at_sbcglobal.net> skrev i en meddelelse
news:3f16c3f7$1...@newsgroups.borland.com...
> Brett, I was wishing for a way that would not require
> modification of the source when Delphi8 came out.
John,
Your posts are usually pretty sensible,
but I don't know if I can go down this
road with you.
How do you define 'greater than' on defines?
If you don't want to go with a common public
ver file, I think rolling your own is a better approach
than changing the language.
{ VER80 Delphi 1.0
VER90 Delphi 2.0
VER93 C++Builder 1.0
VER100 Delphi 3.0
VER110 C++Builder 3.0
VER120 Delphi 4.0
VER125 C++Builder 4.0
VER130 Delphi 5.0
VER135 C++Builder 5.0
VER140 Delphi 6.0
VER150 Delphi 7.0
}
{$IFDEF VER80}
{$DEFINE DELPHI1}
{$ENDIF}
{$IFDEF VER90}
{$DEFINE DELPHI2}
{$ENDIF}
{$IFDEF VER93}
{$DEFINE BCB1}
{$ENDIF}
{$IFDEF VER100}
{$DEFINE DELPHI3}
{$ENDIF}
{$IFDEF VER110}
{$DEFINE BCB3}
{$ENDIF}
{$IFDEF VER120}
{$DEFINE DELPHI4}
{$ENDIF}
{$IFDEF VER125}
{$DEFINE BCB4}
{$ENDIF}
{$IFDEF VER130}
{$DEFINE DELPHI5}
{$ENDIF}
{$IFDEF VER135}
{$DEFINE BCB5}
{$ENDIF}
{$IFDEF VER140}
{$DEFINE DELPHI6}
{$ENDIF}
{$IFDEF VER150}
{$DEFINE DELPHI7}
{$ENDIF}
{$IFDEF WIN32}
{$DEFINE D2_OR_HIGHER}
{$ENDIF}
{$IFNDEF DELPHI1}
{$IFNDEF DELPHI2}
{$IFNDEF BCB1}
{$DEFINE D3_OR_HIGHER}
{$IFNDEF DELPHI3}
{$DEFINE BCB3_OR_HIGHER}
{$IFNDEF BCB3}
{$DEFINE D4_OR_HIGHER}
{$IFNDEF DELPHI4}
{$DEFINE BCB4_OR_HIGHER}
{$IFNDEF BCB4}
{$DEFINE D5_OR_HIGHER}
{$IFNDEF DELPHI5}
{$DEFINE BCB5_OR_HIGHER}
{$IFNDEF BCB5}
{$DEFINE D6_OR_HIGHER}
{$IFNDEF DELPHI6}
{$DEFINE D7_OR_HIGHER}
{$ENDIF}
{$ENDIF}
{$ENDIF}
{$ENDIF}
{$ENDIF}
{$ENDIF}
{$ENDIF}
{$ENDIF}
{$ENDIF}
{$ENDIF}
--
Thanks,
Brad White
That *is* the problem.
Maybe Borland could let have some of these built into the
compiler, like
In compiler VER16 it could define
Delphi8, Delphi8Plus, Delphi7Plus, Delphi6Plus, Delphi5Plus, & etc.
In compiler VER15 it would define
Delphi7, Delphi7Plus, Delphi6Plus, Delphi5Plus, & etc.
In compiler VER14 it would define
Delphi6, Delphi6Plus, Delphi5Plus, & etc....
And etc. down to
In compiler VER90 it would define
Delphi2, Delphi2Plus, and Delphi1Plus
In compiler VER80 it would define
Delphi1 and Delphi1Plus
I have left out a lot, but I hope that you can see the pattern.
Regards, JohnH
--
Regards,
Peter Thornqvist (JVCL Coordinator)
http://jvcl.sourceforge.net
Flip your logic.
{$IFDEF VER120} // delphi 4
{$DEFINE Delphi4Minus}
{$ENDIF}
{$IFDEF VER110} // delphi 3
{$DEFINE Delphi4Minus}
{$ENDIF}
... etc.
Then use:
{$IFNDEF Delphi4Minus}
// you code
{$ENDIF}
When Delphi 8, 9, etc. comes out, then the code will
be included.
What you are really saying is you want code
included if you are not using Delphi4 and lower?
The above works fine.
> would be nice if we could do greater-than and less-than
>test on "defines".
No. If Delphi added this in say Delphi8 and you used it,
then it would ensure that your code wouldn't compile under
Delphi 7, 6, 5, etc. anyway because the older compilers
wouldn't know that "IFDEF_LESS_THAN" was anyway.
i.e.
{$IFDEF_LESS_THAN VER160}
// pointless, a D7- compiler won't buy it anyway.
{$END}
Might as well just say:
{$IFDEF Delphi7Minus}
This project may not be compiled except under Delphi 8+.
{$ENDIF}
Thanks,
Brett
"John Herbster (TeamB)" <herb-sci1_at_sbcglobal.net> wrote in message
news:3f16c3f7$1...@newsgroups.borland.com...
"a" <blwa...@shaw.ca> wrote
> Flip your logic.
That is what I meant and thought that I was saying.
> > would be nice if we could do greater-than and less-than
> >test on "defines".
> No. If Delphi added this in say Delphi8 and you used it,
> then it would ensure that your code wouldn't compile under
> Delphi 7, 6, 5, etc. anyway because the older compilers
True. What I meant to imply is that if way back in the
beginning of conditional compilation flags, they had allowed
greater and less than comparisons, it might have helped.
Rgds, JohnH
Perhaps I missed something but this feature already is there in Delphi 7 (at
least) why not use (for never compilers) the defined CompilerVersion and
RTLVersion consts.
Like this
{$IF RTLVersion >= 15} for Delphi 7.
For more ease you could define.
const
DelphiVer = CompilerVersion - 8;
And do a test with this. {$IF DelphiVer >= 7}
Delphi 3 also supports $IF-directive so you could define DelphiVer using the
old defines and then use $IF to distinguish easily between the versions
where you need.
Wouldn't that work?
Regards Maël.
No, Maël, you were not missing anything. I was. How
did you happen to discover this? Regards, JohnH
By the way
"If RTLVersion > 15 then ...;"
May be optimized out *by the complier* for versions
15 or less, so that the test may be done at compile-time
rather than at run time.
> By the way
> "If RTLVersion > 15 then ...;"
> May be optimized out *by the complier* for versions
> 15 or less, so that the test may be done at compile-time
> rather than at run time.
I tested. It IS optimized out.
If you don't like this you can define a variable that "hides" the consts:
var
RTLVersion: Extended = System.RTLVersion; //same works for compilerversion
then there is no optimization done.
Conclusion:
If $IF does not work in Delphi < 6 we cannot use CompilerVersion for
conditional typedefinitions:
{$IF CompilerVersion = 3}
type
Int64 = TLargeInteger;
{$IFEND}
We still would need to use $IFDEF :-(
Regards, Maël.
"Maël Hörz" wrote:
>
> I noticed that $IF in Delphi 3 does not work as
> expected.
This directive was introduced in D6.
--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
If there is somebody up there could they throw me down a line. Just a
little helping hand just a little understanding. Just some answers to the
questions that surround me now. If there's somebody up there could
they throw me down a line. (Fish)