Problem with struct packing of 1

Hi,

we used the qcc compiler option -Wc,-fpack-struct for packed structs. This works very well, but now I have found in IF.H the
following struct:



/*

  • Structure used in SIOCGIFCONF request.
  • Used to retrieve interface configuration
  • for machine (useful for programs which
  • must know all networks accessible).
    /
    struct ifconf {
    #ifdef QNX
    short ifc_len; /
    FIXME /
    #else
    int ifc_len; /
    size of associated buffer */
    #endif
    union {
    caddr_t ifcu_buf;
    struct ifreq ifcu_req;
    } ifc_ifcu;
    #define ifc_buf ifc_ifcu.ifcu_buf /
    buffer address /
    #define ifc_req ifc_ifcu.ifcu_req /
    array of structures returned */
    };

Since the define QNX is always set by default we must use this ugly trick:

#if defined (QNXNTO)
#if defined (QNX)
#undef QNX
#endif
#endif

Is this problem already well-known?


Thanks,
Hermann

E-Mail: Leenings.Hermann@Scheidt-Bachmann.de

Yes, it is well known. Some things ported to QNX4 will have to be
‘unported’ before they can work on QNX6. It’s because QNX originally
thought there’s lot of similarity between QNX4 and QNX6 so they defined
the same symbols in compiler :wink:

  • igor

Hermann Leenings wrote:

Hi,

we used the qcc compiler option -Wc,-fpack-struct for packed structs. This works very well, but now I have found in IF.H the
following struct:



/*

  • Structure used in SIOCGIFCONF request.
  • Used to retrieve interface configuration
  • for machine (useful for programs which
  • must know all networks accessible).
    /
    struct ifconf {
    #ifdef QNX
    short ifc_len; /
    FIXME /
    #else
    int ifc_len; /
    size of associated buffer */
    #endif
    union {
    caddr_t ifcu_buf;
    struct ifreq ifcu_req;
    } ifc_ifcu;
    #define ifc_buf ifc_ifcu.ifcu_buf /
    buffer address /
    #define ifc_req ifc_ifcu.ifcu_req /
    array of structures returned */
    };

Since the define QNX is always set by default we must use this ugly trick:

#if defined (QNXNTO)
#if defined (QNX)
#undef QNX
#endif
#endif

Is this problem already well-known?

Thanks,
Hermann

E-Mail: > Leenings.Hermann@Scheidt-Bachmann.de