Subject: Re: Checking for NetBSD version
To: Alan Barrett <email@example.com>
From: Frederick Bruckman <firstname.lastname@example.org>
Date: 11/17/2003 02:31:25
On Mon, 17 Nov 2003, Alan Barrett wrote:
> On Mon, 17 Nov 2003, email@example.com wrote:
> > What is "the correct way" of checking NetBSD version (1.x vs -current) in
> > source code (with preprocessor)? In other words, how should I rewrite
> > the "if 1" line in the following code fragment?
> #include <sys/param.h>
> #if defined(__NetBSD_Version__) && (__NetBSD_Version__ < 106110000)
> /* NetBSD < 1.6K does not have separate read/write statistics. */
I seem to recall that the change occurred *in* 1.6K. There's no
backwards compatibility, so someone's going to lose no matter where
you draw the line.
BTW, you can simplify by turning that around:
#if __NetBSD_Version__ >= 106110000
/* separate read/write statistics */
/* ... */
as __NetBSD_Version__ will compare numerically as if it were "0" for
non-NetBSD or older NetBSD systems (for any ANSI compiler).