NetBSD Problem Report #1819

From gnats  Wed Dec  6 20:23:23 1995
Received: from icicle by pain.lcs.mit.edu (8.6.12/8.6.9) with ESMTP id UAA06604 for <gnats-bugs@gnats.netbsd.org>; Wed, 6 Dec 1995 20:14:24 -0500
Message-Id: <199512060422.WAA22284@taniemarie.solon.com>
Date: Tue, 5 Dec 1995 22:22:26 -0600
From: Peter Seebach <seebs@taniemarie>
Reply-To: seebs@taniemarie
To: gnats-bugs@gnats.netbsd.org
Subject: putc and getc macros are incorrect
X-Send-Pr-Version: 3.95

>Number:         1819
>Category:       standards
>Synopsis:       bug in getc and putc macros
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    standards-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 06 20:35:04 +0000 1995
>Closed-Date:    Sat May 08 22:46:05 +0000 1999
>Last-Modified:  Sat May 08 23:00:28 +0000 1999
>Originator:     Peter Seebach
>Release:        1.1
>Organization:
Usenet Fact Police (Undercover)
>Environment:
System: NetBSD taniemarie 1.1 NetBSD 1.1 (SEEBS) #3: Tue Nov 28 18:59:30 CST 1995 seebs@taniemarie:/usr/src/sys/arch/amiga/compile/SEEBS amiga


>Description:
	The putc and getc macros do not function correctly when the pointer
	argument is of type (void *).  They should, to properly behave like
	functions with prototypes in scope.
>How-To-Repeat:
	#include <stdio.h>

	main () {
		void *v;

		v = stdin;
		getc(v);
		return 0;
	}
>Fix:
	Add casts to (FILE *) in <stdio.h>.

	(Unfortunately, this will introduce a lack of warning for non-pointer
	arguments.)
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: gnats-admin->standards-manager 
Responsible-Changed-By: fair 
Responsible-Changed-When: Wed Apr 21 10:20:37 PDT 1999 
Responsible-Changed-Why:  
This is the responsibility of the NetBSD Standards Conformance PR manager, 
not the GNATS database administrator. 
State-Changed-From-To: open->closed 
State-Changed-By: kleink 
State-Changed-When: Sat May 8 15:46:05 PDT 1999 
State-Changed-Why:  
By advising about multiple evaluations of the stream argument being possible 
due to getc() and putc() possibly being implemented as macros, I think the 
description section of the standard makes the implicit requirement that the 
stream argument be of type FILE *; hence I do not consider the current 
implementation not a bug although I'm still open to a formal interpretation 
request being submitted to the committee. 

Also, even the submitted fixing suggestion doesn't fail to point out the 
drawbacks of such a `fix', which are greater than those of the current 
implementation. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.