This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

netinet/in.h and C++


Hi!

I downloaded eCos CVS yesterday and noticed one thing in FreeBSD stack that
bothers me. Namely,
net/bsd_tcpip/current/include/netinet/in.h has defined:

struct ip_opts {
    struct  in_addr ip_dst;     /* first hop, 0 w/o src rt */
    int8_t      ip_opts[40];    /* actually variable in size */
};

which is fine for C source files. However, ANSI C++ doesn't allow data
members with the same name as enclosing class. Therefore, it is not possible
to include <netinet/in.h> (nor <network.h>, which includes it) in
application C++ sources.

I found that the 'old' OpenBSD network stack has simple fix for that problem
in
net/tcpip/current/include/netinet/in.h:

struct ip_opts {
    struct  in_addr ip_dst;     /* first hop, 0 w/o src rt */
#if defined(__cplusplus)
    int8_t      Ip_opts[40];    /* cannot have same name as class */
#else
    int8_t      ip_opts[40];    /* actually variable in size */
#endif
};

Could we put the same fix (CVS) in FreeBSD to make including <network.h>
possible with C++ source files?

Thanks,
Jura

========================================================

--- packages/net/bsd_tcpip/current/include/netinet/in.h        2002-05-21
00:25:02.000000000 +0200
+++ packages/net/bsd_tcpip/current/include/netinet/in.new.h
2002-10-04 14:17:08.000000000 +0200
@@ -320,7 +320,11 @@
  */
 struct ip_opts {
        struct  in_addr ip_dst;         /* first hop, 0 w/o src rt */
-       char    ip_opts[40];            /* actually variable in size */
+#if defined(__cplusplus)
+       int8_t          Ip_opts[40];    /* cannot have same name as class */
+#else
+       int8_t          ip_opts[40];    /* actually variable in size */
+#endif
 };

 /*



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]