🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #52681

Re: prototypes with short args gen

#52681
From: Martin Gaeckler
Date: Wed, 10 Jun 1992 20:53
25 lines
1275 bytes
aab@cichlid.com am Mo, 08.06.92 18:49 in GCC.HELP:

>int foo(short x);
>int bar(short x);
>
>int foo(short x) {} /* this works */
>
>int bar(x) short x; {} /* this does not */

The code is indeed illegal. You must not mix function prototypes mixed with
old style function definitions. When using old style function definitions
chars and shorts are expanded to ints. This won't be done with new style
function definitions.

In exact:

- The prototype "int bar( short x );" tells the compiler that the function
  bar expects a short integer.

- The function definition "int bar(x) short x; {}" tells the compiler that
  this function expects an integer which is used as an short integer.

regards

Martin
Technical Details
Message-ID: <A18073@M.maus.de>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!uniol!hb.maus.de!m.maus.de!Martin_Gaeckler
References: <A48826@HB.maus.de>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,ab99dfd242dbf7ad,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1992-06-10 17:46:40 PST
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!uniol!hb.maus.de!m.maus.de!Martin_Gaeckler
From: Martin_Gaeckler@m.maus.de (Martin Gaeckler)
Newsgroups: gnu.gcc.help
Subject: Re: prototypes with short args gen
Message-ID: <A18073@M.maus.de>
Date: Wed, 10 Jun 92 20:53:00 GMT
References: <A48826@HB.maus.de>
Organization: MausNet
Lines: 25
X-Gateway: MausGate/News 1.07