From owner-freebsd-hackers Sat Aug 8 19:46:22 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id TAA28830 for freebsd-hackers-outgoing; Sat, 8 Aug 1998 19:46:22 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from elvis.vnet.net (elvis.vnet.net [166.82.1.5]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id TAA28825 for ; Sat, 8 Aug 1998 19:46:19 -0700 (PDT) (envelope-from rivers@dignus.com) Received: from dignus.com (ponds.vnet.net [166.82.177.48]) by elvis.vnet.net (8.8.8/8.8.4) with ESMTP id VAA16003; Sat, 8 Aug 1998 21:45:15 -0400 (EDT) Received: from lakes.dignus.com (lakes [10.0.0.3]) by dignus.com (8.8.8/8.8.5) with ESMTP id WAA16415; Sat, 8 Aug 1998 22:19:45 -0400 (EDT) Received: (from rivers@localhost) by lakes.dignus.com (8.8.8/8.6.9) id VAA28991; Sat, 8 Aug 1998 21:49:23 -0400 (EDT) Date: Sat, 8 Aug 1998 21:49:23 -0400 (EDT) From: Thomas David Rivers Message-Id: <199808090149.VAA28991@lakes.dignus.com> To: jdp@polstra.com, rivers@dignus.com Subject: Re: C and static initialization with unions Cc: hackers@FreeBSD.ORG In-Reply-To: <199808082104.OAA20050@austin.polstra.com> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > > Let me add to this discussion my (now somewhat tired) song regarding > > compiling older pre-ANSI software. > > > > It's very nice that we can 'turn off' "const", "volatile", > > prototypes in the header files; just for this purpose... > > > > Every now-and-then, a stray "const" seems to slip into the headers; > > which breaks some of my older software... > > How could that happen? We don't change your old software. We change > FreeBSD. FreeBSD is built using the FreeBSD compiler. That compiler > is not K&R, and it never will be K&R again. If you are using an old > compiler to compile FreeBSD header files, then I can only say, "Don't > do that." We have explicitly abandoned the goal of being compatible > with K&R compilers. I believe you can find more details in the mail archives... I've sent out mail on it in the past. > > If you mean that your old software isn't const-correct, then (a) > that's a compiler warning under FreeBSD, not an error, and (b) isn't > it about time you fixed your software? The ANSI/ISO C standard was > ratified almost 10 years ago. Surely everybody has had ample time to > get used to the idea by now. Actually, the problem I have is with new software... The situation is that I have a set of portable C code which has to be compiled with a non-ANSI compiler. Now, you're right that I shouldn't have to contend with a non-ANSI compiler in this day and age, but here's the reasons I do: 1) Typically, the ANSI compiler is an add-on cost, using the "free" non-ANSI compiler can save money. 2) On at least one machine, the ANSI compiler has soooo many bugs as to make it unusable. So, in order to ferret out potential problems *before* I try to compile on those platforms where I don't have gcc, and have to use the non-ANSI compiler; I use -traditional on FreeBSD. Every now-and-then, a stray 'const' will appear in the freebsd system headers; which breaks the -traditional compilation. It's kinda bothersome, especially since defines a nice symbol to handle this (__const). For example, in 2.2.6; resolve.h has: resolv.h:extern const struct res_sym __p_class_syms[]; resolv.h:extern const struct res_sym __p_type_syms[]; resolv.h:const char * sym_ntos __P((const struct res_sym *, int, int *)); resolv.h:const char * sym_ntop __P((const struct res_sym *, int, int *)); resolv.h:const char * loc_ntoa __P((const u_char *, char *)); resolv.h:const char * hostalias __P((const char *)); resolv.h:const char * p_class __P((int)); resolv.h:const char * p_time __P((u_int32_t)); resolv.h:const char * p_type __P((int)); ... though it explicitly #includes The one I typically run into is : time.h:const char *strptime __P((const char *, const char *, struct tm *)); so normally the first thing I do after an installation of a new FreeBSD is fix time.h [I believe there already is a PR# of this particular problem.] My point is; it sure is nice for the -traditional option to actually work... and every now-and-then, you have a reasonable reason for wanting it to. - Dave Rivers - To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message