home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / hp / 14430 < prev    next >
Encoding:
Text File  |  1992-12-30  |  1.7 KB  |  64 lines

  1. Newsgroups: comp.sys.hp
  2. 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
  3. From: mhr@hpuerca.atl.hp.com (Mike Reaser)
  4. Subject: Re: cc -Aa does not like unsigned short
  5. Message-ID: <C03BDn.KsD@hpuerca.atl.hp.com>
  6. Date: Wed, 30 Dec 1992 20:53:46 GMT
  7. Distribution: usa
  8. References: <1992Dec30.200114.5642@gtech.com>
  9. Organization: a stone mountain of Kudzu
  10. Lines: 52
  11.  
  12. In <1992Dec30.200114.5642@gtech.com> ayr@gtech.com (Aleksey Y. Romanov) writes:
  13.  
  14. >Hi, I have a following problem
  15.  
  16. >#if defined(__STDC__)
  17. >int foo(unsigned short);
  18. >#else
  19. >int foo();
  20. >#endif
  21.  
  22. >int
  23. >foo(s)
  24. >    unsigned short s;
  25. >{
  26. >   ...
  27. >}
  28.  
  29. >gives me an error 1711: Inconsistent parameter list declaration for "foo"
  30. >when compiled with -Aa option.
  31.  
  32.  
  33. It's because when we encounter "s", no type declaration is encountered,
  34. thus the default of "int" is used.  When "s" is then redeclared as an
  35. unsigned short, the error occurs.
  36.  
  37. You are mixing ANSI prototypes with K&R-style function definitions.
  38. If you rewrite your code as follows, all should be fine:
  39.  
  40. #if defined(__STDC__)
  41. int foo(unsigned short);
  42. #else
  43. int foo();
  44. #endif
  45.  
  46. int
  47. #if defined(__STDC__)                       <------------
  48. foo(unsigned short s)                       <------------
  49. #else                                       <------------
  50. foo(s)
  51.     unsigned short s;
  52. #endif                                      <------------
  53. {
  54.    ...
  55. }
  56.  
  57. The "<------------" indicate the added lines.  Good luck!
  58.  
  59. --
  60. =======================================================================
  61.  Mike Reaser, Hewlett-Packard N. Amer. Response Center - Atlanta
  62.  Internet:  mhr@hpuerca.atl.hp.com
  63. =======================================================================
  64.