You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by arpadboda <gi...@git.apache.org> on 2018/12/05 11:49:21 UTC

[GitHub] nifi-minifi-cpp pull request #455: MINIFICPP-689 - Make minifi::Exception co...

GitHub user arpadboda opened a pull request:

    https://github.com/apache/nifi-minifi-cpp/pull/455

    MINIFICPP-689 - Make minifi::Exception constructible with string param

    Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.
    
    In order to streamline the review of the contribution we ask you
    to ensure the following steps have been taken:
    
    ### For all changes:
    - [ ] Is there a JIRA ticket associated with this PR? Is it referenced
         in the commit message?
    
    - [ ] Does your PR title start with MINIFICPP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
    
    - [ ] Has your PR been rebased against the latest commit within the target branch (typically master)?
    
    - [ ] Is your initial contribution a single, squashed commit?
    
    ### For code changes:
    - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
    - [ ] If applicable, have you updated the LICENSE file?
    - [ ] If applicable, have you updated the NOTICE file?
    
    ### For documentation related changes:
    - [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
    
    ### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/arpadboda/nifi-minifi-cpp MINIFICPP-689

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/nifi-minifi-cpp/pull/455.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #455
    
----
commit 7238bfa77e587f6bb370ea7733431961fb145a5f
Author: Arpad Boda <ab...@...>
Date:   2018-12-05T11:45:42Z

    MINIFICPP-689 - Make minifi::Exception constructible with string param

----


---

[GitHub] nifi-minifi-cpp pull request #455: MINIFICPP-689 - Make minifi::Exception co...

Posted by arpadboda <gi...@git.apache.org>.
Github user arpadboda commented on a diff in the pull request:

    https://github.com/apache/nifi-minifi-cpp/pull/455#discussion_r239140370
  
    --- Diff: libminifi/include/Exception.h ---
    @@ -60,16 +60,17 @@ class Exception : public std::exception {
      public:
       // Constructor
       /*!
    -   * Create a new flow record
    +   * Create a new exception
        */
    -  Exception(ExceptionType type, const char *errorMsg)
    +  Exception(ExceptionType type, std::string errorMsg)
           : _type(type),
    -        _errorMsg(errorMsg) {
    +        _errorMsg(std::move(errorMsg)) {
    --- End diff --
    
    As far as I remember that warning is only applied for return values, where moving could prevent copy-elision, but it's not the case. 


---

[GitHub] nifi-minifi-cpp pull request #455: MINIFICPP-689 - Make minifi::Exception co...

Posted by phrocker <gi...@git.apache.org>.
Github user phrocker commented on a diff in the pull request:

    https://github.com/apache/nifi-minifi-cpp/pull/455#discussion_r239144107
  
    --- Diff: libminifi/include/Exception.h ---
    @@ -60,16 +60,17 @@ class Exception : public std::exception {
      public:
       // Constructor
       /*!
    -   * Create a new flow record
    +   * Create a new exception
        */
    -  Exception(ExceptionType type, const char *errorMsg)
    +  Exception(ExceptionType type, std::string errorMsg)
           : _type(type),
    -        _errorMsg(errorMsg) {
    +        _errorMsg(std::move(errorMsg)) {
       }
    +
       // Destructor
    -  virtual ~Exception() throw () {
    +  virtual ~Exception() noexcept {
    --- End diff --
    
    I'm not sure how that applies to my comment...but I think the end result is that I will still run basic tests across compilers. Are you suggesting we needn't run tests for verification and validation?


---

[GitHub] nifi-minifi-cpp pull request #455: MINIFICPP-689 - Make minifi::Exception co...

Posted by phrocker <gi...@git.apache.org>.
Github user phrocker commented on a diff in the pull request:

    https://github.com/apache/nifi-minifi-cpp/pull/455#discussion_r239117109
  
    --- Diff: libminifi/include/Exception.h ---
    @@ -60,16 +60,17 @@ class Exception : public std::exception {
      public:
       // Constructor
       /*!
    -   * Create a new flow record
    +   * Create a new exception
        */
    -  Exception(ExceptionType type, const char *errorMsg)
    +  Exception(ExceptionType type, std::string errorMsg)
           : _type(type),
    -        _errorMsg(errorMsg) {
    +        _errorMsg(std::move(errorMsg)) {
    --- End diff --
    
    Just saw this when I was typing the one below, I'll run the build before merging obviously, but does this not generate an elision warning?


---

[GitHub] nifi-minifi-cpp pull request #455: MINIFICPP-689 - Make minifi::Exception co...

Posted by phrocker <gi...@git.apache.org>.
Github user phrocker commented on a diff in the pull request:

    https://github.com/apache/nifi-minifi-cpp/pull/455#discussion_r239144665
  
    --- Diff: libminifi/include/Exception.h ---
    @@ -60,16 +60,17 @@ class Exception : public std::exception {
      public:
       // Constructor
       /*!
    -   * Create a new flow record
    +   * Create a new exception
        */
    -  Exception(ExceptionType type, const char *errorMsg)
    +  Exception(ExceptionType type, std::string errorMsg)
           : _type(type),
    -        _errorMsg(errorMsg) {
    +        _errorMsg(std::move(errorMsg)) {
    --- End diff --
    
    Ah yah. I don't remember either, but that sounds right  If I don't see the warning when I run the build then all is well that ends well. Thanks. 


---

[GitHub] nifi-minifi-cpp pull request #455: MINIFICPP-689 - Make minifi::Exception co...

Posted by phrocker <gi...@git.apache.org>.
Github user phrocker commented on a diff in the pull request:

    https://github.com/apache/nifi-minifi-cpp/pull/455#discussion_r239117254
  
    --- Diff: libminifi/include/Exception.h ---
    @@ -60,16 +60,17 @@ class Exception : public std::exception {
      public:
       // Constructor
       /*!
    -   * Create a new flow record
    +   * Create a new exception
        */
    -  Exception(ExceptionType type, const char *errorMsg)
    +  Exception(ExceptionType type, std::string errorMsg)
           : _type(type),
    -        _errorMsg(errorMsg) {
    +        _errorMsg(std::move(errorMsg)) {
       }
    +
       // Destructor
    -  virtual ~Exception() throw () {
    +  virtual ~Exception() noexcept {
    --- End diff --
    
    I didn't notice that throw was here. Odd choice. The compiler usually generates an implicit noexcept unless told otherwise, so I'm tempted to do a little more testing of this across compilers. I'll do this before merge. 


---

[GitHub] nifi-minifi-cpp pull request #455: MINIFICPP-689 - Make minifi::Exception co...

Posted by arpadboda <gi...@git.apache.org>.
Github user arpadboda commented on a diff in the pull request:

    https://github.com/apache/nifi-minifi-cpp/pull/455#discussion_r239145213
  
    --- Diff: libminifi/include/Exception.h ---
    @@ -60,16 +60,17 @@ class Exception : public std::exception {
      public:
       // Constructor
       /*!
    -   * Create a new flow record
    +   * Create a new exception
        */
    -  Exception(ExceptionType type, const char *errorMsg)
    +  Exception(ExceptionType type, std::string errorMsg)
           : _type(type),
    -        _errorMsg(errorMsg) {
    +        _errorMsg(std::move(errorMsg)) {
       }
    +
       // Destructor
    -  virtual ~Exception() throw () {
    +  virtual ~Exception() noexcept {
    --- End diff --
    
    No, I wouldn't skip them. Just meant that the change should be identical, so if it worked, it should still work _in theory_, but we are engineers, so let's see the results. :) 


---

[GitHub] nifi-minifi-cpp pull request #455: MINIFICPP-689 - Make minifi::Exception co...

Posted by arpadboda <gi...@git.apache.org>.
Github user arpadboda commented on a diff in the pull request:

    https://github.com/apache/nifi-minifi-cpp/pull/455#discussion_r239140994
  
    --- Diff: libminifi/include/Exception.h ---
    @@ -60,16 +60,17 @@ class Exception : public std::exception {
      public:
       // Constructor
       /*!
    -   * Create a new flow record
    +   * Create a new exception
        */
    -  Exception(ExceptionType type, const char *errorMsg)
    +  Exception(ExceptionType type, std::string errorMsg)
           : _type(type),
    -        _errorMsg(errorMsg) {
    +        _errorMsg(std::move(errorMsg)) {
       }
    +
       // Destructor
    -  virtual ~Exception() throw () {
    +  virtual ~Exception() noexcept {
    --- End diff --
    
    throw() == noexcept, however throw() is deprecated since C++11. 


---

[GitHub] nifi-minifi-cpp pull request #455: MINIFICPP-689 - Make minifi::Exception co...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/nifi-minifi-cpp/pull/455


---