Re: [Fwd: RFC.. defining __rangeof() in cdefs.h]

From: Maxime Henrion <mux_at_freebsd.org>
Date: Thu, 12 Aug 2004 00:56:02 +0200
Julian Elischer wrote:
> Interresting.. not a single comment.. :-/
> 

> From: Julian Elischer <julian_at_elischer.org>
> Date: Mon, 09 Aug 2004 14:40:37 -0700
> To: current_at_freebsd.org
> Subject: RFC.. defining __rangeof() in cdefs.h
> 
> I'm considdereing adding:
> Index: sys/cdefs.h
> ===================================================================
> RCS file: /home/ncvs/src/sys/sys/cdefs.h,v
> retrieving revision 1.83
> diff -u -r1.83 cdefs.h
> --- sys/cdefs.h 28 Jul 2004 07:03:42 -0000      1.83
> +++ sys/cdefs.h 9 Aug 2004 21:36:41 -0000
> _at__at_ -241,6 +241,8 _at__at_
>  * require it.
>  */
> #define        __offsetof(type, field) ((size_t)(&((type *)0)->field))
> +#define        __rangeof(type, start, end) \
> +       (__offsetof(type, end) - __offsetof(type, start))
> 
> /*
>  * Compiler-dependent macros to declare that functions take printf-like
> 
> 
> it is used in several places. most importantly in fork1()
> 
> and it is defined in several files (*).. we should probably just have 
> one copy...
> 
> 
> (*) in the form RANGEOF() but if we define it in cdefs.h I'd change that to
> __rangeof() to match __offsetof()

The patch looks fine to me, I think it should go in. :-)

Cheers,
Maxime
Received on Wed Aug 11 2004 - 20:56:02 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:05 UTC