Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Jan 2011 19:22:58 -0800
From:      Garrett Cooper <gcooper@FreeBSD.org>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        svn-src-head@freebsd.org, mdf@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r217369 - in head/sys: cam/scsi sys
Message-ID:  <AANLkTi=B5mZCJ_bhe=Gf1pLUmWsTswi3O3U2ZLnHMODV@mail.gmail.com>
In-Reply-To: <20110115133929.D16210@besplex.bde.org>
References:  <201101131820.p0DIKXip059402@svn.freebsd.org> <AANLkTinh619WaGgq=5fFxTvEX0JPir34k8xb%2Bs6oSH8Y@mail.gmail.com> <20110114174719.D28159@besplex.bde.org> <AANLkTikVwuSO3h8tKeYXCvC6zqYVHVxdY5Abrzo-Ks2R@mail.gmail.com> <20110115133929.D16210@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jan 14, 2011 at 6:42 PM, Bruce Evans <brde@optusnet.com.au> wrote:
> On Fri, 14 Jan 2011 mdf@FreeBSD.org wrote:
>
>> On Thu, Jan 13, 2011 at 10:50 PM, Bruce Evans <brde@optusnet.com.au>
>> wrote:
>>>
>>> On Thu, 13 Jan 2011 mdf@freebsd.org wrote:
>>>
>>>> There appear to be 330 uses of SYSCTL and QUAD on the same line in
>>>> CURRENT. =A0This seems reasonable to change them to S64, U64 and X64 s=
o
>>>> they correctly reflect the size they operate upon.
>>>>
>>>> What do y'all think?
>>>
>>> Now I suggest delaying this until they can be renamed to a type- generi=
c
>>> SYSCTL_INT() (would probably need to be spelled differently, SYSCTL_I()
>>> say, even if SYSCTL_INT() was changed at the same time).
>>
>> I'm torn on this one. =A0The compiler knows the type (unless, for
>> SYSCTL_INT, NULL/0 is used, but that is also a compile-time check),
>> but to interpret it requires the use of __builtin_foo which is a gcc
>> extension and not part of standard C.
>>
>> Philosophically, while I like this kind of letting the compiler do the
>> work, if you want C++ you know where to find it.
>
> Oops. =A0I think sizeof() and issigned() can be used to determine the typ=
e
> well enough in functions and initialized data (do a fuller type check if
> the compiler supports it), but I don't know how to do this in static
> sysctl declarations (since sizeof() can't be used in cpp expressions).

    Why not just create some dumb testcases that can be run at build
time to determine that for you?
-Garrett



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTi=B5mZCJ_bhe=Gf1pLUmWsTswi3O3U2ZLnHMODV>