This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Interleaving pthread_cleanups in C and C++
- From: Zack Weinberg <zack at codesourcery dot com>
- To: Michael Matz <matz at suse dot de>
- Cc: gcc at gcc dot gnu dot org
- Date: Sun, 04 May 2003 15:20:20 -0700
- Subject: Re: Interleaving pthread_cleanups in C and C++
- References: <Pine.LNX.4.44.0305042316270.25297-100000@wotan.suse.de>
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