🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1872

problem with function prototypes

#1872
From: "Karl Berry."
Date: Fri, 21 Oct 1988 19:27
32 lines
1394 bytes
This is gcc 1.30, on a Sun 3 running 3.4, and a Vax 750 running 4.3bsd.

This function matches its prototype. gcc claims it doesn't.
(The GhostScript code uses this kind of prototyping.)

void debug_print_string(unsigned char);

/* Print a string */
void
debug_print_string(x)
unsigned char x;
{
 x = 10;
}

This produces the following:
gcc version 1.30
 /usr/local/gnu/lib/gcc-cpp -v -undef -D__GNU__ -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__HAVE_68881__ -Dmc68020 /tmp/x.c /tmp/cca03378.cpp
GNU CPP version 1.30
 /usr/local/gnu/lib/gcc-cc1 /tmp/cca03378.cpp -quiet -dumpbase /tmp/x.c -version -o /tmp/cca03378.s
GNU C version 1.30 (68k, MIT syntax) compiled by GNU C version 1.30.
/tmp/x.c: In function debug_print_string:
/tmp/x.c:7: argument `x' doesn't match function prototype


The problem does not occur if the function is declared by
...(unsigned char x);

instead of in the old-style C declarations.
 

Karl.    karl@umb.edu ...!harvard!umb!karl
Technical Details
Message-ID: <8810211927.AA03381@typo.umb.edu>
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!killer!texbell!bigtex!natinst!cs.utexas.edu!tut.cis.ohio-state.edu!typo.umb.edu!karl

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!ddsw1!lll-winken!killer!texbell!bigtex!natinst!cs.utexas.edu!tut.cis.ohio-state.edu!typo.umb.edu!karl
From: karl@typo.umb.edu ("Karl Berry.")
Newsgroups: gnu.gcc.bug
Subject: problem with function prototypes
Message-ID: <8810211927.AA03381@typo.umb.edu>
Date: 21 Oct 88 19:27:55 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 31