szaszm commented on code in PR #2174: URL: https://github.com/apache/nifi-minifi-cpp/pull/2174#discussion_r3280918362
########## CMakeLists.txt: ########## @@ -302,7 +301,14 @@ include(GslLite) # Add necessary definitions based on the value of STRICT_GSL_CHECKS, see gsl-lite README for more details list(APPEND GslDefinitions gsl_CONFIG_DEFAULTS_VERSION=1) -list(APPEND GslDefinitionsNonStrict gsl_CONFIG_CONTRACT_VIOLATION_THROWS gsl_CONFIG_NARROW_THROWS_ON_TRUNCATION=1) +list(APPEND GslDefinitions gsl_FEATURE_BYTE=1) +list(APPEND GslDefinitions gsl_CONFIG_NARROW_THROWS_ON_TRUNCATION=1) Review Comment: I don't think it was a mistake. The idea with STRICT_GSL_CHECKS was that by default, in debug mode, contract violations crash (std::terminate), while in release mode, they throw, but by changing this option to strict, you can force release builds to crash early too. A narrowing conversion that results in value change is a contract violation, similar to failed gsl_Expects. In the new version of gsl-lite, the defaults have changed, so the configuration needs to be rewritten. For example, gsl_CONFIG_NARROW_THROWS_ON_TRUNCATION=1 is the default now, but we probably only want it in non strict mode. In strict mode, it should terminate, not throw. There are other config and default changes in their docs too, that's why I'm advocating for a full rewrite of this section. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
