From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2126 invoked by alias); 26 Apr 2002 17:30:18 -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 2099 invoked from network); 26 Apr 2002 17:30:14 -0000 Received: from unknown (HELO nondot.org) (64.5.103.85) by sources.redhat.com with SMTP; 26 Apr 2002 17:30:14 -0000 Received: by nondot.org (Postfix, from userid 501) id 7B01511883; Fri, 26 Apr 2002 12:27:07 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by nondot.org (Postfix) with ESMTP id 76C5A1183E; Fri, 26 Apr 2002 12:27:07 -0500 (CDT) Date: Fri, 26 Apr 2002 10:30:00 -0000 From: Chris Lattner To: Tim Hollebeek Cc: Subject: Re: pure and const functions In-Reply-To: <20020426132525.A30261@pcp736370pcs.reston01.va.comcast.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2002-04/txt/msg01431.txt.bz2 > > There may be other cases where functions are "partial", can you give > > another example? > > There are similar obvious trivial examples: > int hang_unless_positive(int n) /* a const function */ { > if (n <= 0) while (1) ; > return n; > } Sure, but are there any good examples of a function that would be _useful_ to be marked as pure or const, but which might not return? I know that it's certainly possible to come up with straw man examples that show these cases, but the question is whether or not it's worth the implementation effort to add this. The only way to get some approximation of an answer to this is to get some sense for how often this comes up. Currently the situation is that if you have one of these functions, you cannot mark it pure, is that correct? -Chris http://www.nondot.org/~sabre/os/ http://www.nondot.org/~sabre/Projects/