mesos-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benjamin Mahler (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (MESOS-1055) Add explicit to single argument constructors
Date Thu, 27 Mar 2014 18:11:14 GMT

     [ https://issues.apache.org/jira/browse/MESOS-1055?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Benjamin Mahler updated MESOS-1055:
-----------------------------------

    Fix Version/s:     (was: 0.18.0)
                   0.19.0

> Add explicit to single argument constructors
> --------------------------------------------
>
>                 Key: MESOS-1055
>                 URL: https://issues.apache.org/jira/browse/MESOS-1055
>             Project: Mesos
>          Issue Type: Improvement
>          Components: c++ api
>            Reporter: Dominic Hamon
>            Assignee: Bernd Mathiske
>            Priority: Minor
>              Labels: c++, newbie
>             Fix For: 0.19.0
>
>
> From the google style guide:
> Normally, if a constructor takes one argument, it can be used as a conversion. For instance,
if you define Foo::Foo(string name) and then pass a string to a function that expects a Foo,
the constructor will be called to convert the string into a Foo and will pass the Foo to your
function for you. This can be convenient but is also a source of trouble when things get converted
and new objects created without you meaning them to. Declaring a constructor explicit prevents
it from being invoked implicitly as a conversion.
> Implicit conversions should be the exception to avoid unwanted and unexpected behaviour.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message