From: Thomas Demmer Newsgroups: comp.os.msdos.djgpp Subject: Re: Function Sizes Date: Mon, 18 Aug 1997 11:57:06 +0200 Organization: Lehrstuhl fuer Stroemungsmechanik Lines: 38 Message-ID: <33F81C71.D9650386@LSTM.Ruhr-UNI-Bochum.De> References: NNTP-Posting-Host: c64.lstm.ruhr-uni-bochum.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Eli Zaretskii wrote: > > On Sun, 17 Aug 1997, *** Brett *** wrote: > > > > Is there a function or keyword which can determine the size of an actual > > > function from a reference to it? I've tried sizeof(), but it returns the > > > size of the reference instead of the actual function. > > > > > > > The way to do it is to declare a "null" function directly after the one you > > want the size of, and then subtract the two pointers (I think). I _do_ know > > that I saw this in the FAQ - it related to locking code in protected > > mode. > > A word of caution is in order. If you use this technique, please be > aware that you cannot be always sure that it will work. Subtle > changes in compiler optimizations in some future release could > rearrange functions and break this trick altogether. And it will probably give you rubbish if the compiler decides to inline a function. BTW, is there a keyword to keep the compiler to do this on its own? Just the opposite of ``inline'' ? -- Ciao Tom ************************************************************* * Thomas Demmer * * Lehrstuhl fuer Stroemungsmechanik * * Ruhr-Uni-Bochum * * Universitaetsstr. 150 * * D-44780 Bochum * * Tel: +49 234 700 6434 * * Fax: +49 234 709 4162 * * http://www.lstm.ruhr-uni-bochum.de/~demmer * *************************************************************