delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/19/18:38:46

From: Thomas Demmer <demmer AT LSTM DOT Ruhr-UNI-Bochum DOT De>
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: <Pine DOT SUN DOT 3 DOT 91 DOT 970817195755 DOT 14271f-100000 AT is>
NNTP-Posting-Host: c64.lstm.ruhr-uni-bochum.de
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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                *
*************************************************************

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019