From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 4 00:25:45 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ABDE816A4E5 for ; Tue, 4 Jul 2006 00:25:45 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.FreeBSD.org (Postfix) with ESMTP id ACC6C43D46 for ; Tue, 4 Jul 2006 00:25:41 +0000 (GMT) (envelope-from keramida@ceid.upatras.gr) Received: from gothmog.pc (host5.bedc.ondsl.gr [62.103.39.229]) (authenticated bits=128) by igloo.linux.gr (8.13.7/8.13.7/Debian-1) with ESMTP id k640PMVX025998 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 4 Jul 2006 03:25:24 +0300 Received: from gothmog.pc (gothmog [127.0.0.1]) by gothmog.pc (8.13.7/8.13.7) with ESMTP id k640PHnS091635; Tue, 4 Jul 2006 03:25:17 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from giorgos@localhost) by gothmog.pc (8.13.7/8.13.7/Submit) id k640PC5e091634; Tue, 4 Jul 2006 03:25:12 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Date: Tue, 4 Jul 2006 03:25:12 +0300 From: Giorgos Keramidas To: Mike Meyer Message-ID: <20060704002512.GA91588@gothmog.pc> References: <16887068.1151618963387.JavaMail.root@elwamui-cypress.atl.sa.earthlink.net> <20060630081019.GB734@turion.vk2pj.dyndns.org> <002501c69ecf$5967c6b0$6302a8c0@pentiv> <44A9AC43.3090606@jamesbailie.com> <17577.45340.818482.432245@bhuda.mired.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <17577.45340.818482.432245@bhuda.mired.org> X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (score=-3.542, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.86, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Spam-Status: No Cc: James Bailie , freebsd-hackers@freebsd.org, Randall Hyde Subject: Re: getc in BSD (was FLEX issues) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jul 2006 00:25:45 -0000 On 2006-07-03 20:06, Mike Meyer wrote: > In <44A9AC43.3090606@jamesbailie.com>, James Bailie typed: > > Randall Hyde wrote: > > > This kind of gives me the impression that "getc" is defined a bit > > > differently under FreeBSD than other environments? Any ideas? > > Yes. It's defined as a macro. > > Linux says that getc "may be implemented as a macro". Anything that > needs a function should be using fgetc, not getc. But The C99 standard (actually the latest public draft[1]) allows getc() to be a macro: [1] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf from http://www.open-std.org/jtc1/sc22/wg14/www/standards | §7.19.7.5 The getc function | | Synopsis | | 1 #include | int getc(FILE *stream); | | Description | | 2 The getc function is equivalent to fgetc, except that if it is | implemented as a macro, it may evaluate stream more than once, | so the argument should never be an expression with side | effects. This means one shouldn't depend on getc() being a function.