home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.hp
- Path: sparky!uunet!usc!sol.ctr.columbia.edu!ira.uka.de!rz.uni-karlsruhe.de!ry66
- From: ry66@rz.uni-karlsruhe.de (Andreas Ley)
- Subject: Is there a bug in HPs ANSI-C compiler?
- Message-ID: <1992Aug21.223144.6013@rz.uni-karlsruhe.de>
- Sender: usenet@rz.uni-karlsruhe.de (USENET News System)
- Reply-To: ley@rz.uni-karlsruhe.de
- Organization: University of Karlsruhe, Germany
- Date: Fri, 21 Aug 1992 22:31:44 GMT
- Lines: 49
-
- While compiling some Amiga :-) source code I ran into a problem which led to
- the following little program (which actually does nothing):
-
- -------------------------------------->8---------------------------------------
- typedef struct s1 {
- int i;
- } t1;
-
- struct s2 {
- void (*p1) (struct s1);
- void (*p2) (struct s1 *);
- void (*p3) (t1 *);
- };
-
- void f1(struct s1 p)
- {}
-
- void f2(struct s1 *p)
- {}
-
- main()
- {
- struct s2 t = {
- f1,
- f2,
- f2,
- };
- }
- -------------------------------------->8---------------------------------------
-
- Now, when I run it through cc -Aa, I get an
- error 1574: Unknown size for "<<<NULL_SYMBOL>>>"
- in line 6 - the compiler doesn't like only a struct as formal parameter
- prototype, which causes the compiler to fail again in line 20 where I
- reference the struct member. It does like a pointer to a struct as in line 7,
- but has problems assigning a value to it in line 21:
- warning 604: Pointers are not assignment-compatible.
- If I typedef the struct, there is none of these problems! The program also
- compiles fine under AIX, VMS and gcc (unfortunatly I have no ansi compiler
- on or sun).
- The question is: Is this really a compiler bug or am I doing something wrong?
-
- Bye, Andy
-
- -------------------------------------------------------------------------------
- Andreas Ley ! "Even when you're ! Email: ley@rz.uni-karlsruhe.de
- Nelkenstr. 9 ! a genius, life is ! s_ley@irav1.ira.uka.de
- W-7500 Karlsruhe 1 ! a mystery!" ! RY66@DKAUNI2.BITNET
- Germany ! Doogie Howser, M.D. ! Voice: +49 721 84 10 36
-