From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12098 invoked by alias); 9 May 2003 12:08:12 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 12079 invoked from network); 9 May 2003 12:08:11 -0000 Received: from unknown (HELO mulga.cs.mu.OZ.AU) (128.250.1.22) by sources.redhat.com with SMTP; 9 May 2003 12:08:11 -0000 Received: from ceres.cs.mu.oz.au (mail@ceres.cs.mu.OZ.AU [128.250.33.10]) by mulga.cs.mu.OZ.AU with ESMTP id WAA01442; Fri, 9 May 2003 22:08:03 +1000 (EST) Received: from fjh by ceres.cs.mu.oz.au with local (Exim 3.35 #1 (Debian)) id 19E6G5-0005nC-00; Fri, 09 May 2003 21:41:49 +1000 Date: Fri, 09 May 2003 12:08:00 -0000 From: Fergus Henderson To: Andrew Haley Cc: Ranjit Mathew , gcc@gcc.gnu.org Subject: Re: __attribute__((cleanup(function)) versus try/finally Message-ID: <20030509114149.GA22178@ceres.cs.mu.oz.au> References: <16059.32748.60695.113159@cuddles.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <16059.32748.60695.113159@cuddles.redhat.com> User-Agent: Mutt/1.3.28i X-SW-Source: 2003-05/txt/msg00880.txt.bz2 On 09-May-2003, Andrew Haley wrote: > Actually, the C standard is quite explicit about this: signal handlers > may return either by a return statement of calling longjmp(). [I think you meant to say "or" instead of "of".] What you say is true to some extent, but it only applies to signal handlers for synchronous signals, i.e. those caused by an explicit call to abort() or raise(). For asynchronous signals, the behaviour is undefined if the signal handler calls longjmp(), due to C99 7.14.1.1 paragraph 5, which prohibits such signal handlers from calling *any* standard library function other than abort(), _Exit(), or signal(): | If the signal occurs other than as the result of | calling the abort or raise function, the behavior is | undefined if the signal handler refers to any object with | static storage duration other than by assigning a value to | an object declared as volatile sig_atomic_t, or the signal | handler calls any function in the standard library other | than the abort function, the _Exit function, or the signal | function with the first argument equal to the signal number | corresponding to the signal that caused the invocation of | the handler. -- Fergus Henderson | "I have always known that the pursuit The University of Melbourne | of excellence is a lethal habit" WWW: | -- the last words of T. S. Garp.