www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/17/13:04:57

Date: Sun, 17 Aug 1997 19:58:26 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: *** Brett *** <bporter AT rabble DOT uow DOT edu DOT au>
cc: Mike4148 <mike4148 AT aol DOT com>, DJGPP <djgpp AT delorie DOT com>
Subject: Re: Function Sizes
In-Reply-To: <199708170025.KAA06148@rabble.uow.edu.au>
Message-ID: <Pine.SUN.3.91.970817195755.14271f-100000@is>
MIME-Version: 1.0

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.

- Raw text -


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