Interleaving pthread_cleanups in C and C++
Zack Weinberg
zack@codesourcery.com
Sun May 4 22:20:00 GMT 2003
Michael Matz <matz@suse.de> writes:
> Hi,
>
> On Sat, 3 May 2003, Zack Weinberg wrote:
>
>> Mark's proposal IMHO goes way too far down the "anything but a
>> language extension!" road; however, I am a little leery of generic
>> try/finally in C, given the objections raised way back when,
>
> If you could remind me again which those objections were specifically?
> IIRC the only one was "no language extension in GCC", despite that
> extension being implemented in most other real world compilers, and the
> completely trivial specification of it.
The specific objection that I remember was that, under Windows, it
wouldn't work exactly the way try/finally do with MSVC; it would not
interoperate with the "structured exception handling" mechanism used
by the system. And that this would be contrary to user expectations.
>> and besides which it isn't clear to me that try/finally are really what
>> is wanted. It seems to me that the appropriate extension is a subset of
>> C++'s destructor functionality, allowing one to write something like
>
> Pardon me? If I understand correctly you propose to add something like
> C++ destructors (or a subset, whatever that means) to C to not have to add
> try/finally? Surely you are kidding, aren't you? You must be. Compared
> with defining try/finally, defining that extension would be _major_ work.
> IMHO those are strange ideas to just not have to do try/finally, sorry.
Not true; Geoff showed upthread how this could be done with an
extension no broader than strictly necessary. My use of C++ syntax
was illustrative, not intended to be a proposal.
zw
More information about the Gcc
mailing list