From owner-freebsd-arch@FreeBSD.ORG Thu May 15 21:09:31 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B648337B401 for ; Thu, 15 May 2003 21:09:31 -0700 (PDT) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id E650743F93 for ; Thu, 15 May 2003 21:09:30 -0700 (PDT) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.8/8.12.3) with ESMTP id h4G49SkA051987; Thu, 15 May 2003 22:09:29 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Thu, 15 May 2003 22:08:54 -0600 (MDT) Message-Id: <20030515.220854.43850940.imp@bsdimp.com> To: sullivan@gaia.arc.nasa.gov From: "M. Warner Losh" In-Reply-To: References: X-Mailer: Mew version 2.1 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: arch@freebsd.org Subject: Re: Pardon the ignorance X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 May 2003 04:09:32 -0000 In message: Don Sullivan writes: : : In the change to stdio.h in FreeBSD 4.8, you say: : "std{in,out,err} are no longer compile time constants." : : Please pardon my incredible ignorance, but what does that mean ? : Can you please point me to a reference ? : : FILE *def_thing = stdout; : : no longer works. : apparently, it shouldn't. why ? >From the C-90 standard, section 7.19 paragraph #3 Because 'stdout' isn't guaranteed to be a compile time constant: stderr stdin stdout which are expressions of type ``pointer to FILE'' that point to the FILE objects associated, respectively, with the standard error, input, and output streams. Since they are not 'constant expressions ...' it means that they aren't guaranteed to evaludate to a constant at compile time. FILE *def_thing = stdout; requires that stdout be a compile time constant when it is at the top level. Traditionally, it has been a compile time constant on some implementations, so the above would work. However, there are issues with making it a compile time constant and still being able to make the size of FILE larger over the course of time. Warner