tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] libtcc API v.s. global state v.s. tcc state


From: grischka
Subject: Re: [Tinycc-devel] libtcc API v.s. global state v.s. tcc state
Date: Mon, 21 Apr 2008 00:34:52 +0200

From: "David Given":
> grischka wrote:
> [...]
> > Well, I need to suggest something.  So, maybe I'd move the bits in 
> > tcc_delete, that mess with globals, out from tcc_delete into another 
> > function.  Then that function (name it "tcc_cleanup") can be called 
> > from tcc_new instead.  How is this?
> 
> Well, speaking as someone who deals with embedded stuff a fair bit, what
> *I* would really like is for all the global data to get shunted off into
> the TCCState structure and explicit globals not actually get used anywhere.

Not that we wouldn't really like this too.

> This would allow multiple independent TCCStates:
>
> tcc1 = tcc_new()
> tcc2 = tcc_new()
> tcc_compile(tcc1, ...)
> tcc_compile(tcc2, ...)
> tcc_delete(tcc1)
> tcc_delete(tcc2)
> 
> This would make it considerably more useful IMO (as well as matching the
> behaviour to what the API suggests). How difficult would it be?

Difficult? Not at all. Just a big mess.  Make dozens of functions 
take one more parameter, change hundreds of calls to them, and 
prefix hundreds of variable accesses with "s->".

But go for it, we'll happily take it. 

I just wonder if there isn't some swiss-knife emacs around that can 
do that in 100 milliseconds ...

--- grischka





reply via email to

[Prev in Thread] Current Thread [Next in Thread]