Re: New keywords: ifdef, elsifdef, end ifdef

new topic     » goto parent     » topic index » view thread      » older message » newer message

Shawn Pringle wrote:
> 
> That sounds like optimization:
> 

It's much more than that. It's the ability for conditional includes. It's the
ability to remove code from bound or executable code you may not want in there
(such as shareware/full), It gives you the function of even being able to
maintain backwards compatability! Say for instance 4.1 comes out and 4.1 defines
a new function called fast_find or who knows what. You can now:

ifdef EU400 then
    global function fast_find(...)
    end function
end ifdef


All sorts of other things.

Imagine this:

while 1 do
    if debug = 1 then
        puts(1, "Reading xyz...\n")
    end if
    -- code
end while


Well, before you ship your app, you should remove all your if debug = 1
statements. Now look at:

while 1 do
    ifdef debug then
        puts(1, "Reading xyz...\n")
    end ifdef
    -- code
end while


Now, run your app: exwc -D debug myapp.ex  or translate: ecu myapp.ex That loop
may run 100,000 times in your application. Hm, in fact, I have that in a web app
that is small time and it takes about 8 million hits a month now to the dynamic
side of the app. Granted, that's not big, but, it's not a for 1 = 1 to 10 loop
either.

--
Jeremy Cowgar
http://jeremy.cowgar.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu