home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.hp
- Path: sparky!uunet!paladin.american.edu!gatech!swrinde!sdd.hp.com!col.hp.com!news.dtc.hp.com!hpscit.sc.hp.com!hpuerca.atl.hp.com!mhr
- From: mhr@hpuerca.atl.hp.com (Mike Reaser)
- Subject: Re: cc -Aa does not like unsigned short
- Message-ID: <C03BDn.KsD@hpuerca.atl.hp.com>
- Date: Wed, 30 Dec 1992 20:53:46 GMT
- Distribution: usa
- References: <1992Dec30.200114.5642@gtech.com>
- Organization: a stone mountain of Kudzu
- Lines: 52
-
- In <1992Dec30.200114.5642@gtech.com> ayr@gtech.com (Aleksey Y. Romanov) writes:
-
- >Hi, I have a following problem
-
- >#if defined(__STDC__)
- >int foo(unsigned short);
- >#else
- >int foo();
- >#endif
-
- >int
- >foo(s)
- > unsigned short s;
- >{
- > ...
- >}
-
- >gives me an error 1711: Inconsistent parameter list declaration for "foo"
- >when compiled with -Aa option.
-
-
- It's because when we encounter "s", no type declaration is encountered,
- thus the default of "int" is used. When "s" is then redeclared as an
- unsigned short, the error occurs.
-
- You are mixing ANSI prototypes with K&R-style function definitions.
- If you rewrite your code as follows, all should be fine:
-
- #if defined(__STDC__)
- int foo(unsigned short);
- #else
- int foo();
- #endif
-
- int
- #if defined(__STDC__) <------------
- foo(unsigned short s) <------------
- #else <------------
- foo(s)
- unsigned short s;
- #endif <------------
- {
- ...
- }
-
- The "<------------" indicate the added lines. Good luck!
-
- --
- =======================================================================
- Mike Reaser, Hewlett-Packard N. Amer. Response Center - Atlanta
- Internet: mhr@hpuerca.atl.hp.com
- =======================================================================
-