Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Dec 1998 13:50:08 -0700
From:      Warner Losh <imp@village.org>
To:        Alex Zepeda <garbanzo@hooked.net>
Cc:        current <current@FreeBSD.ORG>
Subject:   Re: egcs chokes on netinet/in.h.. 
Message-ID:  <199812312050.NAA01102@harmony.village.org>
In-Reply-To: Your message of "Thu, 31 Dec 1998 11:42:33 PST." <Pine.BSF.4.05.9812311139420.321-100000@zippy.dyn.ml.org> 
References:  <Pine.BSF.4.05.9812311139420.321-100000@zippy.dyn.ml.org>  

next in thread | previous in thread | raw e-mail | index | archive | help

In message <Pine.BSF.4.05.9812311139420.321-100000@zippy.dyn.ml.org> Alex Zepeda writes:
: > extern "C" {
: > #include <netinet/in.h>
: > }
: 
: I'd rather not "fix" our code, *sigh*.

Does the proposed fix fix the problem?  I'd be surprised if it
actually fixed the problem.  extern "C" doesn't mean treat the
following as having C semantics, just that the following has C linkage
and calling conventions (which are two different things in this case).

About the only thing that I could suggest would be to have a member
that is named differently for C++, like motif and Xt do for a member
named 'class'.

Actually, I could see something like:
struct ip_opts {
	struct	in_addr ip_dst;		/* first hop, 0 w/o src rt */
	char	ipopts[40];		/* actually variable in size */
};

#ifndef __cplusplus
#define ip_opts ipopts
#endif

But that runs into problems when you say struct ip_opts, so that
wouldn't work.  I fear the best solution would be:
struct ip_opts {
	struct	in_addr ip_dst;		/* first hop, 0 w/o src rt */
#ifdef __cplusplus
	char	ipopts[40];		/* actually variable in size */
#else
	char	ip_opts[40];
#endif
};


And then in your code you could say something gross like:

#ifndef __FreeBSD
#define ioopts io_ipts
#endif

But then it will fail in the same way with newer compilers on other
systems.

Warner

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199812312050.NAA01102>