Re: ($DEFINE) seems to stay within the one .pas file




"Christakis John" <dontemail@xxxxxxxxxxxx> wrote in message
news:sNFwe.9744$oJ.3205@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> is this the case? I use a unit in two projects and want some code not to
> appear for the second project, so I did this:

> But, it appears that this is not the case and only adding the $DEFINE to
the
> top of unit4 will it work. This means I have to edit unit4 everytime I
> compile project1 or project2? Is there another way to do this without
> saving a separate unit4.pas and having concurrent almost identical files
to
> update?

source defines , one file

project options conditional defines .. all files

include file in each, modify define in include

Delphi is weak in this area, or you could see it as :
firmly resisting non-source-local scope and build order
dependencies :-)

An in-code flag test takes almost no clocks, chances are the
code space saving is not very large.

I know, it somehow feels all dirty and wrong to check
a flag 50 times a second, yet once all the optimisation is done the
result is the CPU clocks 3GHz in the idle loop a fraction of a second
earlier. With luck the user will be blinking and won't notice it.

Cost of CPU clock 10MHz per second $1, for that you get to
check 1 millions flags per second , forever.
{$ifdef pedant}
conditions apply :-)
{$endif}



.