Patrick,

Before my change: 
 
  If prg contains Global vars which are manipulated in several
sub-function in the same file, we have to declare ppGlobals in each
functions. Now, it is written as a file wide static, so that we no
longer required to declare it the old way.

Some illustration (compile with -gc3):

---8<---
GLOBAL myGlobal

Proc Main()
 my Global := 0

Static Function X()
 myGlobal := 1
---8<---

NOW is is written as below:

...
static PHB_ITEM *ppGlobals = pGlobals;

HB_FUNC( MAIN)
{
  hb_xvm*Global( ...&ppGlobals );

HB_FUNC_STATIC( X )
{
  hb_xvm*Global( ...&ppGlobals );


BEFORE:

HB_FUNC( MAIN )
{
  static PHB_ITEM *ppGlobals = pGlobals;
  ..
  hb_xvm*Global( ...&ppGlobals );

HB_FUNC( X )
{
  static PHB_ITEM *ppGlobals = pGlobals;
  ..
  hb_xvm*Global( ...&ppGlobals );


MORE BEFORE:

   ... DID NOT WORK ...


IOW, the changes make the C output more compact.

--
Andi

On Fri, 28 Nov 2008 08:47:54 +0100
"Patrick Mast, xHarbour." <[EMAIL PROTECTED]> wrote:

> Message-ID: <[EMAIL PROTECTED]>
> 
> Hey Andi,
> 
> >  * source/compiler/genc.c
> >  * source/compiler/gencc.c
> >    ! make global variable as file wide static.
> 
> Can you explain this a little more?
> Thanks! ;-)
> 
> Patrick


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
xHarbour-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xharbour-developers

Reply via email to