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]

Re: netinet/in.h and C++


On Fri, 2002-10-04 at 06:36, Jurica Baricevic wrote:
> 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?
> 

What version of CVS are you working from?  I fixed this 4 months ago.

    2002-06-05  Gary Thomas  <gary@chez-thomas.org>
    
    	* include/netinet/in.h: Rename 'ip_opts' field (using the same
    	name as the structure is illegal in C++).


-- 
------------------------------------------------------------
Gary Thomas                  |
eCosCentric, Ltd.            |  
+1 (970) 229-1963            |  eCos & RedBoot experts
gthomas@ecoscentric.com      |
http://www.ecoscentric.com/  |
------------------------------------------------------------


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