Boost logo

Boost :

Subject: Re: [boost] [compute] review
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2014-12-28 18:44:04


On Mon, Dec 29, 2014 at 1:31 AM, John Bytheway
<jbytheway+boost_at_[hidden]> wrote:
> On 2014-12-28 14:41, Kyle Lutz wrote:
>> On Sun, Dec 28, 2014 at 1:54 AM, Gruenke,Matt <mgruenke_at_[hidden]> wrote:
>>> I'm a bit concerned about the use of type names ending in '_', such as float4_. Is this consistent with Boost conventions? I've only seen that used in other Boost libraries to denote class member variables.
>>
>> I'm not sure if there are any Boost conventions for/against this
>> (someone please speak up if there are). I chose the trailing
>> underscore for these types as I needed a consistent spelling for
>> representing the fundamental OpenCL types (e.g. "float" or "uint" or
>> "int4") and I couldn't just use the names without the trailing
>> underscore as they'd conflict with the C++ reserved keywords (e.g.
>> "float", "int"). Using a leading underscore (e.g. "_float4") looked
>> worse to me, so I used a trailing underscore. But I'd definitely be
>> open to hearing other ideas.
>
> There is precedent for the trailing underscore convention. See for
> example
> <http://www.boost.org/doc/libs/1_57_0/libs/mpl/doc/refmanual/numeric.html>.

The trailing underscore syntax is typically used when a library
construct has semantics very similar to a language component which
uses a keyword. I.e. mpl::if_ is similar to the language if, and
mpl::int_ to the language int, except that mpl tools operate at
compile time. In this case, I think, the semantics is sufficiently
different (vector types instead of scalar), which should warrant for a
distinct and descriptive names.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk