home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / hp / 9536 < prev    next >
Encoding:
Text File  |  1992-08-21  |  2.0 KB  |  61 lines

  1. Newsgroups: comp.sys.hp
  2. Path: sparky!uunet!usc!sol.ctr.columbia.edu!ira.uka.de!rz.uni-karlsruhe.de!ry66
  3. From: ry66@rz.uni-karlsruhe.de (Andreas Ley)
  4. Subject: Is there a bug in HPs ANSI-C compiler?
  5. Message-ID: <1992Aug21.223144.6013@rz.uni-karlsruhe.de>
  6. Sender: usenet@rz.uni-karlsruhe.de (USENET News System)
  7. Reply-To: ley@rz.uni-karlsruhe.de
  8. Organization: University of Karlsruhe, Germany
  9. Date: Fri, 21 Aug 1992 22:31:44 GMT
  10. Lines: 49
  11.  
  12. While compiling some Amiga :-) source code I ran into a problem which led to
  13. the following little program (which actually does nothing):
  14.  
  15. -------------------------------------->8---------------------------------------
  16. typedef struct s1 {
  17.     int    i;
  18. } t1;
  19.  
  20. struct s2 {
  21.     void (*p1) (struct s1);
  22.     void (*p2) (struct s1 *);
  23.     void (*p3) (t1 *);
  24. };
  25.  
  26. void f1(struct s1 p)
  27. {}
  28.  
  29. void f2(struct s1 *p)
  30. {}
  31.  
  32. main()
  33. {
  34.     struct s2 t = {
  35.         f1,
  36.         f2,
  37.         f2,
  38.     };
  39. }
  40. -------------------------------------->8---------------------------------------
  41.  
  42. Now, when I run it through cc -Aa, I get an
  43.     error 1574: Unknown size for "<<<NULL_SYMBOL>>>"
  44. in line 6 - the compiler doesn't like only a struct as formal parameter
  45. prototype, which causes the compiler to fail again in line 20 where I
  46. reference the struct member. It does like a pointer to a struct as in line 7,
  47. but has problems assigning a value to it in line 21:
  48.     warning 604: Pointers are not assignment-compatible.
  49. If I typedef the struct, there is none of these problems! The program also
  50. compiles fine under AIX, VMS and gcc (unfortunatly I have no ansi compiler
  51. on or sun).
  52. The question is: Is this really a compiler bug or am I doing something wrong?
  53.  
  54. Bye, Andy
  55.  
  56. -------------------------------------------------------------------------------
  57.    Andreas Ley       !  "Even when you're   !  Email: ley@rz.uni-karlsruhe.de 
  58.    Nelkenstr. 9      !   a genius, life is  !         s_ley@irav1.ira.uka.de
  59.  W-7500 Karlsruhe 1  !   a mystery!"        !         RY66@DKAUNI2.BITNET
  60.    Germany           !  Doogie Howser, M.D. !  Voice: +49 721 84 10 36
  61.