Re: No more platform(), conditional includes, conditional functions, condit
- Posted by CChris <christian.cuvier at agricultur?.?ouv.fr> May 13, 2008
- 644 views
Jeremy Cowgar wrote: > > Jeremy Cowgar wrote: > > > > > > > > ex --define=debug test.ex > > > > > > > Yes, it can: > > > > ex -Ddebug -Djohndoe -Dsimple test.ex > > > > More over, I want to stress that this is *not* a pre-processor. A > pre-processor > will load the source file, scan from top to bottom looking for pre-processor > keywords. The pre-processor would then alter the code as necessary and the > pass > it on to the parser. > > That is not what ifdef does. Ifdef is a compile time execution keyword. It > does > not inject any of it's own code into the IL or C translated output. It does > not inject any of the "FALSE" defines into IL or C code. > > What this means is that the ifdef keyword causes no speed change in Euphoria > like a pre-processor would. If you use it, you will get a performance hit > equivalent > to executing 1 if statement 1 time (well, per condition you have of course). > And again, that happens at parse time, not every iteration, because it's never > injected into IL or C. That is important to note. It's not a pre-processor. > > -- > Jeremy Cowgar > <a href="http://jeremy.cowgar.com">http://jeremy.cowgar.com</a> I think ifdef would be even more useful with a couple predefined variables. One I'm thinking about is "version":
ifdef version-3.1.1 then x=find_from(0,s,5) else x=find(0,s[5..$]) if x>0 then x+=(5-1) end if end if
Of course, this particular code won't work because 3.1.1 doesn't recognise ifdef, but you get the idea.... CChris