Nested structures in headers and C++ compatibility?

Peter Dufault dufault at hda.com
Thu Oct 16 15:06:50 UTC 2014


On Oct 16, 2014, at 10:18 , Gedare Bloom <gedare at rtems.org> wrote:

> Maybe introduce a new conditional typedef would work, something like..
> 
> #ifdef __cplusplus
> typedef SIU_tag::SIU_PCR_tag SIU_PCR_tag
> #endif
> 
> Then the structure definition can stay the same.
> 
> I haven't seen this before so I don't know if it would work, but it
> makes sense to me.
> 
> -Gedare

No, it wouldn't work.  The structure definition includes:

union SIU_PCR_tag pcr;

so you need to change the structure definition to remove "union" and you need a corresponding not-C++ typedef for SIU_PCR_tag - it's back to my second suggestion.

Peter
-----------------
Peter Dufault
HD Associates, Inc.      Software and System Engineering



More information about the users mailing list