[smartmontools-support] C++14/17 (will break compatibility)

Christian Franke Christian.Franke at t-online.de
Sat Feb 1 12:32:31 CET 2025


Hi,

Christian Rosentreter via Smartmontools-support wrote:
>
>> configure: WARNING:
>> This version of smartmontools does not use C++14 or C++17 enhancements,
>> but future versions possibly will.
>> This script was unable to determine a compiler option to enable C++17.
>> Please send info about compiler and platform to
>> smartmontools-support at listi.jpberlin.de - Thanks!
>

Thanks for the feedback.

The warning could be suppressed with the configure option 
'--without-cxx11-option' if the compiler supports at least C++11 by default.


> $ gcc --version
> Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1
> Apple LLVM version 7.0.2 (clang-700.1.81)
> Target: x86_64-apple-darwin14.5.0
> Thread model: posix
>
> $ g++ --version
> Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1
> Apple LLVM version 7.0.2 (clang-700.1.81)
> Target: x86_64-apple-darwin14.5.0
> Thread model: posix

According to https://clang.llvm.org/cxx_status.html C++17 should be 
supported since Clang 5.

The test in the configure script might return a false negative. Please 
test these commands:

echo __cplusplus | g++ -E -xc++ -
echo __cplusplus | g++ -std=c++17 -E -xc++ -
echo __cplusplus | g++ -std=gnu++17 -E -xc++ -

The last line shows the __cplusplus value, it should be 201703L if C++17 
(but not C++20) is supported.

Thanks,
Christian


> P.S.: I would prefer if smartmontools would not randomly break backwards compatibility for
>        no real reason. Not everything has to use "enhancements" of newer standards.

PS: It is the very purpose of the above warning to prevent that we drop 
backward compatibility too early. We did this very carefully in the past 
and only if it provided real benefits:
2006: Move from C89 to C++98.
2021(!): Started using some nice C++11 features like in-class member 
initializers.



More information about the Smartmontools-support mailing list