delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/22/03:41:14

Sender: crough45 AT amc DOT de
Message-Id: <97Aug22.093207gmt+0100.17025@internet01.amc.de>
Date: Fri, 22 Aug 1997 08:36:37 +0100
From: Chris Croughton <crough45 AT amc DOT de>
Mime-Version: 1.0
To: ao950 AT FreeNet DOT Carleton DOT CA
Cc: djgpp AT delorie DOT com
Subject: Re: Function Sizes (how to in asm?)

Paul Derbyshire wrote:

> Why doesn't DJ or some other guru modify GCC so that 
> 'sizeof (func)' returns the size of a function?

Why don't you propose it to the ANSI standards committee?
Or to the GCC compiler maintainers?

It has been stated many times that DJGPP is just a port
of gcc, it does not provide extensions to the language.
The ideal will be if gcc can be compiled "out of the box"
for PC (as many GNU programs can be) - this may already be
the case, barring some patches.  Additions to the language
would have to be reapplied each time a new version came
out, and that could be difficult if they change the compiler
internals too much.

In fact, hat you suggest is not nearly as trivial as you
suggest, because it's unlikely that the compiler does know
the size of the compiled function, and certainly not as a
constant because the code is generated by the assembler
after the compiler has finished.  It would have to insert
extra assembly code to put in extra labels and do the
calculation, and this might even require a change to the
assembler.

I suspect the above reasons are why it was not considered
for the ANSI standard or for C++.  It is difficult to
implement for most compilers, and on some (and some machines)
could be impossible.

Chris C

- Raw text -


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