Subject: Re: C vs. prototypes (was: Problems with gdb under NetBSD 1.0 )
To: John Nemeth <jnemeth@cue.bc.ca>
From: Greg A. Woods <woods@kuma.web.net>
List: current-users
Date: 12/15/1994 12:34:39
[ On Wed, December 14, 1994 at 22:11:36 (-0800), John Nemeth wrote: ]
> Subject: Re: C vs. prototypes (was: Problems with gdb under NetBSD 1.0 )
>
> I would have to agree. K&R C is still the most portable form of
> C except for cases where people change standard functions (i.e. does
> signal return void or int {int is supposed to be the previous signal
> handler for the signal in question so that you can restore it if you
> wish}, does lseek take a long or a quad {note that the 'l' stands for
> long}). One of my pet peeves is people that write what is mostly K&R
> C (i.e. no prototypes, etc.), but then stick things like 'void *' in
> the code (just watch my Ultrix compiler blow up on that).
This can be avoided -- I've a sysdep.h file that I've used to write
portable K&R C, while still using void in my code (and using manifests
to sort out the other weird return-type conflicts), and still get it to
compile fine on Ultrix V3, and even on a Tandy 16 (Microsoft C on m68k)!
> Yep, ANSI C compilers don't do cross-file checks and therefore
> can miss a lot of problems. If you feed multiple files to lint, it
> will make two passes, the first for internal consistency problems and
> the second for external consistency problems. Does anybody know of a
> decent free version of lint?
I.e. in keeping with the topic of this mailing list, yes, that's sort of
where I was going with this discussion.
IMHO, NetBSD isn't a great UNIX-like development platform until we can
include a lint on it!
> I'd rather ditch ANSI C, and Hungarian notation (but that's a
> different beef {MS Windows programming is so much fun, NOT!}), even
> though my last name is hungarian.
Too bad POSIX sorta requires ANSI C. We wouldn't need weak references
otherwise either!
--
Greg A. Woods
+1 416 443-1734 VE3TCP robohack!woods
Planix, Inc. <woods@planix.com>; UniForum Canada <woods@uniforum.ca>