Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!timbuk!cs.umn.edu!uc!shamash!hewey!ian From: ian@dms.cdc.com (Ian Hogg) Newsgroups: comp.lang.c++ Subject: struct name {....} name OK? Message-ID: <565@hewey.dms.cdc.com> Date: 15 Oct 90 21:47:55 GMT Organization: Control Data, Empros Division, Plymouth, MN Lines: 45 Someone here is porting timed to C++ (actually he is learning C++ and is porting timed to HP-UX so he's trying to kill two birds with one stone). Anyways, in /usr/include/netinet/ip_icmp.h we have the following definition struct icmp { . . . union { . . . struct ih_idseq { n_short icd_id; n_short icd_seq; } ih_idseq; int ih_void; } icmp_hun; . . . }; In the code we have something like this struct icmp icp; icp.icmp_hun.ih_idseq.icd_id = something_unimportant; This last line generates an error like "union __C9 doesn't have a member ih_idseq". It appears that cfront parses the code without error but generates bad c code. If we move the definition of struct ih_idseq outside of "struct icmp" and declare the member ih_idseq as "struct ih_idseq ih_idseq" then everything is great. I'm using HP's C++(cfront 2.0) on HP 9000/3xx. Is this syntax supposed to be valid? This code does compile with both Oregon C++ and g++. -- Ian Hogg x-4484