, , , ( , ). , :
template <typename T>
inline void debug_type(const T&) __attribute__((deprecated));
template <typename T>
inline void debug_type(const T&) { }
template <typename T>
inline void debug_type() __attribute__((deprecated));
template <typename T>
inline void debug_type() { }
:
debug_type(1);
debug_type<char>();
:
foo.cpp:73:17: warning: 'void debug_type(const T&) [with T = int]' is deprecated (declared at /tmp/arduino_build_static/sketch/Num.h:13) [-Wdeprecated-declarations]
debug_type(1);
^
foo.cpp:74:22: warning: 'void debug_type() [with T = char]' is deprecated (declared at /tmp/arduino_build_static/sketch/Num.h:19) [-Wdeprecated-declarations]
debug_type<char>();
T = int ( , , , ).
A special advantage of this warning in warning of an unused variable, suggested elsewhere, is that the place of the error is the place where it is called debug_type, and not its implementation, therefore the code fragment shown in the error shows an expression of the type (which may be convenient when you want to print several different at the same time).
source
share