tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] Local procedures


From: Zdenek Pavlas
Subject: Re: [Tinycc-devel] Local procedures
Date: Thu, 13 Sep 2007 17:20:45 +0200
User-agent: Thunderbird 1.5.0.12 (X11/20070530)

Antti-Juhani Kaijanaho wrote:
This makes any code that uses qsort and bsearch nonreentrant (and
thus thread-unsafe),
It's orthogonal. You muck with multiple threads? So use TLS. You happen to call another qsort() recursively from the callback? So just in the callback copy the global variable to stack before touching it, and restore when the inner qsort() finishes.
Notice how the code becomes simpler,
You saved exactly *two* (declaration and initialization of one static var) LOCs out of 14, using a feature requiring substantial (but hidden) support at compile time (especially difficult to implement in a 1-pass compiler the TCC is), and at runtime (hidden 16-byte trampoline on the stack). Is that 'simpler'?
how we eliminate a file-scope variable (whose only reason for being there was 
to communicate between
sortint and cmpint and is no business of any other functions defined in the 
same file)
Oh, great. Like fine scoping? So move these "unrelated" functions to another file and you're done.
 and how sortint is thread-safe (assuming qsort is).
Unrelated, see above.

--
Zdenek Pavlas






reply via email to

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