Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Jan 1999 17:47:29 +0100
From:      Martin Cracauer <cracauer@cons.org>
To:        freebsd-arch@FreeBSD.ORG
Subject:   C++ compatible include files (Re: egcs chokes on netinet/in.h)
Message-ID:  <19990105174729.A22338@cons.org>
In-Reply-To: <Pine.BSF.4.05.9812310146490.42452-100000@zippy.dyn.ml.org>; from Alex Zepeda on Thu, Dec 31, 1998 at 01:49:11AM -0800
References:  <Pine.BSF.4.05.9812310146490.42452-100000@zippy.dyn.ml.org>

next in thread | previous in thread | raw e-mail | index | archive | help
[moved to -arch]

In <Pine.BSF.4.05.9812310146490.42452-100000@zippy.dyn.ml.org>, Alex Zepeda wrote: 
> /usr/include/netinet/in.h:291: ANSI C++ forbids data member `ip_opts' with
> same name as enclosing class
> struct ip_opts {
>         struct  in_addr ip_dst;         /* first hop, 0 w/o src rt */
>         char    ip_opts[40];           /* actually variable in size */

There's also the key_t issue, a struct in console.h and a typedef to
long in types.h (for SysV IPC). Since C++ handles structs
automatically as 'typedef struct structname structname;', this breaks
C++ as well.

I think we need a decision whether we will fix FreeBSD include files
to be compatible with ANSI C++. If we decide to do so, the options
are:
- change the definion
- change the definition for C++ only
- disable the definition for C++

In my opinion, only the first one makes sense and also in my opinion
we should have C++-compatible include files.

In case of a decision in this line, I volunteer to:
- search for all uses of ip_opts and change these to the new name of
  the second member in the base FreeBSD system. [If we rename the
  second member].
- Do the same for key_t. If we rename the struct for the console code
  I'll change everything in the base FreeBSD system, add a temporary
  patch to the XFree port and the Linux svga lib and notify
  XFree to use the new name in the next release.
- I'll also fix any port that I suspect will use these or that people
  point to. This includes monitoring -bugs and -ports for such reports.
- Of course, commits are done after a successful `make world`.

Yes, I use C++ sometimes :-)

Martin
-- 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Martin Cracauer <cracauer@cons.org> http://www.cons.org/cracauer/
BSD User Group Hamburg, Germany     http://www.bsdhh.org/

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



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