You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mesos.apache.org by Paul Brett <pb...@twitter.com.INVALID> on 2015/05/29 01:27:31 UTC

constexpr and non-POD static variables

Despite best efforts to avoid non-POD static variables, we appear to still
have over 80 instances (see MESOS-2780).  We can, of course, use const
inline functions to address these but this will change each constant
reference at the calling site to a constant function reference.

A more natural approach provided by C++11 is to use constexpr.  I have
submitted for review (https://reviews.apache.org/r/34782/) an example to
address the TC handle.

What are the views on whitelisting constexpr?

-- Paul Brett

Re: constexpr and non-POD static variables

Posted by Marco Massenzio <ma...@mesosphere.io>.
On Thu, May 28, 2015 at 10:32 PM, Joris Van Remoortere <jo...@mesosphere.io>
wrote:

> @Marco: If you think it hurts to add it to the white-list, then we need to
> have a discussion about wiping the entire white-list.
>

that seems a pretty radical approach, and certainly not one I was advocating
although, I do see your point.


> I think having a white-list, and then not adding things makes it even more
> confusing.
>

my general life philosophy is that, when I'm in a hole, I stop digging :)


>
> On Thu, May 28, 2015 at 10:15 PM, Marco Massenzio <ma...@mesosphere.io>
> wrote:
>
> > On Thu, May 28, 2015 at 4:45 PM, Joris Van Remoortere <
> joris@mesosphere.io
> > >
> > wrote:
> >
> > > We had an internal discussion about this. White-listing constexpr is
> fine
> > > by us.
> > > I think technically the google style guide allows c++11 features that
> are
> > > not explicitly disallowed, but it doesn't hurt to add it to the style
> > guide
> > > :-)
> > >
> >
> > I actually think that *adding* it to the guide does hurt :)
> > (on the other hand, I'm absolutely fine with constexpr)
> >
> > I really like Google's approach of "if it's not explicitly forbidden,
> it's
> > allowed" as it helps people from having to double-guess whether X is
> > allowed or not.
> >
> > my twocent, anyway
> >
> > >
> > > Joris
> > >
> > > On Thu, May 28, 2015 at 4:27 PM, Paul Brett <pbrett@twitter.com.invalid
> >
> > > wrote:
> > >
> > > > Despite best efforts to avoid non-POD static variables, we appear to
> > > still
> > > > have over 80 instances (see MESOS-2780).  We can, of course, use
> const
> > > > inline functions to address these but this will change each constant
> > > > reference at the calling site to a constant function reference.
> > > >
> > > > A more natural approach provided by C++11 is to use constexpr.  I
> have
> > > > submitted for review (https://reviews.apache.org/r/34782/) an
> example
> > to
> > > > address the TC handle.
> > > >
> > > > What are the views on whitelisting constexpr?
> > > >
> > > > -- Paul Brett
> > > >
> > >
> >
>

Re: constexpr and non-POD static variables

Posted by Joris Van Remoortere <jo...@mesosphere.io>.
@Marco: If you think it hurts to add it to the white-list, then we need to
have a discussion about wiping the entire white-list.

I think having a white-list, and then not adding things makes it even more
confusing.

On Thu, May 28, 2015 at 10:15 PM, Marco Massenzio <ma...@mesosphere.io>
wrote:

> On Thu, May 28, 2015 at 4:45 PM, Joris Van Remoortere <joris@mesosphere.io
> >
> wrote:
>
> > We had an internal discussion about this. White-listing constexpr is fine
> > by us.
> > I think technically the google style guide allows c++11 features that are
> > not explicitly disallowed, but it doesn't hurt to add it to the style
> guide
> > :-)
> >
>
> I actually think that *adding* it to the guide does hurt :)
> (on the other hand, I'm absolutely fine with constexpr)
>
> I really like Google's approach of "if it's not explicitly forbidden, it's
> allowed" as it helps people from having to double-guess whether X is
> allowed or not.
>
> my twocent, anyway
>
> >
> > Joris
> >
> > On Thu, May 28, 2015 at 4:27 PM, Paul Brett <pb...@twitter.com.invalid>
> > wrote:
> >
> > > Despite best efforts to avoid non-POD static variables, we appear to
> > still
> > > have over 80 instances (see MESOS-2780).  We can, of course, use const
> > > inline functions to address these but this will change each constant
> > > reference at the calling site to a constant function reference.
> > >
> > > A more natural approach provided by C++11 is to use constexpr.  I have
> > > submitted for review (https://reviews.apache.org/r/34782/) an example
> to
> > > address the TC handle.
> > >
> > > What are the views on whitelisting constexpr?
> > >
> > > -- Paul Brett
> > >
> >
>

Re: constexpr and non-POD static variables

Posted by Marco Massenzio <ma...@mesosphere.io>.
On Thu, May 28, 2015 at 4:45 PM, Joris Van Remoortere <jo...@mesosphere.io>
wrote:

> We had an internal discussion about this. White-listing constexpr is fine
> by us.
> I think technically the google style guide allows c++11 features that are
> not explicitly disallowed, but it doesn't hurt to add it to the style guide
> :-)
>

I actually think that *adding* it to the guide does hurt :)
(on the other hand, I'm absolutely fine with constexpr)

I really like Google's approach of "if it's not explicitly forbidden, it's
allowed" as it helps people from having to double-guess whether X is
allowed or not.

my twocent, anyway

>
> Joris
>
> On Thu, May 28, 2015 at 4:27 PM, Paul Brett <pb...@twitter.com.invalid>
> wrote:
>
> > Despite best efforts to avoid non-POD static variables, we appear to
> still
> > have over 80 instances (see MESOS-2780).  We can, of course, use const
> > inline functions to address these but this will change each constant
> > reference at the calling site to a constant function reference.
> >
> > A more natural approach provided by C++11 is to use constexpr.  I have
> > submitted for review (https://reviews.apache.org/r/34782/) an example to
> > address the TC handle.
> >
> > What are the views on whitelisting constexpr?
> >
> > -- Paul Brett
> >
>

Re: constexpr and non-POD static variables

Posted by Joris Van Remoortere <jo...@mesosphere.io>.
We had an internal discussion about this. White-listing constexpr is fine
by us.
I think technically the google style guide allows c++11 features that are
not explicitly disallowed, but it doesn't hurt to add it to the style guide
:-)

Joris

On Thu, May 28, 2015 at 4:27 PM, Paul Brett <pb...@twitter.com.invalid>
wrote:

> Despite best efforts to avoid non-POD static variables, we appear to still
> have over 80 instances (see MESOS-2780).  We can, of course, use const
> inline functions to address these but this will change each constant
> reference at the calling site to a constant function reference.
>
> A more natural approach provided by C++11 is to use constexpr.  I have
> submitted for review (https://reviews.apache.org/r/34782/) an example to
> address the TC handle.
>
> What are the views on whitelisting constexpr?
>
> -- Paul Brett
>