This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
Re: netinet/in.h and C++
- From: Gary Thomas <gthomas at ecoscentric dot com>
- To: Jurica Baricevic <jura at INTESIS dot hr>
- Cc: eCos patches <ecos-patches at sources dot redhat dot com>
- Date: 04 Oct 2002 06:50:15 -0600
- Subject: Re: netinet/in.h and C++
- References: <NFBBJGOLDDDGJPLCMJKNKEJOCHAA.jura@intesis.hr>
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/ |
------------------------------------------------------------