Re: error in doc

new topic     » goto parent     » topic index » view thread      » older message » newer message
jacques_desch said...

Secondly as ifdef is used at parse-time, in the case of translated application there is no ifdef EUC to be executed to check if it is translated or not.

This is what is unclear to me.

euc has to parse the code initially to make the translation. So, ifdef EUC is done at parse time. Here's an example:

puts(1, "Hello\n") 
ifdef EUC then 
    puts(1, "I am a translated program\n") 
end ifdef 
ifdef EUI then 
    puts(1, "I am an interpreted program\n") 
end ifdef 

C:\myproj> eui myproj.ex 
Hello 
I am an interpreted program 
C:\myproj> euc -keep myprog.ex   rem -keep used to look at the source later 
... translating ... 
... compiling ... 
C:\myproj> myprog.exe 
Hello 
I am a translated program 
C:\myproj> type myprog.c 
... 
EPuts(1, "Hello\n"); 
EPuts(1, "I am a translated program\n"); 
... 

So, the ifdef EUC was executed at parse time which took place during euc myprog.ex. Now, you are right in that the translated program does not execute the "ifdef EUC" check each execution. A translated program is only ever parsed once in it's entire lifetime and that is during translation, not during each execution. That's one of the benefits of a translated program, no parsing stage during execution. Ever.

Jeremy

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

Search



Quick Links

User menu

Not signed in.

Misc Menu