John P Baker wrote:
You are correct in that an optimal situation exists when necessary dynamic
storage can be supplied to a reentrant program by the caller.

However, that is not ALWAYS the case.

My objection is to the use of the term "ALWAYS".

To paraphrase something read years ago, "THE ONLY ABSOLUTE IS THAT THERE ARE
NO ABSOLUTES."

I don't like absolutes either. That's why I _never_ use them. ;-)

My exact words were, "... reentrant code tends to run faster than non-reentrant code ..." The validity of this assertion has been proved by people a lot smarter than I. Cache, TLB, BHT, and paging concerns all contribute to this phenomenon.

Of course, if the reentrant program's path length is substantially longer than that of the equivalent non-reentrant program, any speed advantage will be erased. It's probably not a good idea to place GETMAIN/FREEMAIN in a subroutine.

In C, the main program acquires the stack and heap as part of early initialization. We do something similar in our assembler programs as do (I'm sure) most savvy programmers.

--
Edward E Jaffe
Phoenix Software International, Inc
5200 W Century Blvd, Suite 800
Los Angeles, CA 90045
310-338-0400 x318
[EMAIL PROTECTED]
http://www.phoenixsoftware.com/

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to