Open tathanhdinh opened 6 years ago
Hi all,
Returning a const value does not have much meaning, indeed CppCoreGuidelines notes:
... It is not recommended to return a const value. Such older advice is now obsolete; it does not add value, and it interferes with move semantics.
So the second const in, for example: https://github.com/StanfordPL/x64asm/blob/505ab5e404d0c19a038b91b6690f85c7a087b8c6/src/r.cc#L221
const
can be removed as
return static_cast<const Rh*>(this)->write_att(os);
In recent version of g++, the compiler reports:
g++
ccache g++ -Werror -Wextra -Wall -Wfatal-errors -pedantic -Wno-unused-parameter -Wno-reorder -std=c++11 -fPIC -DNDEBUG -O3 -I./ -c src/r.cc -o src/r.o src/r.cc: In member function 'std::ostream& x64asm::R::write_att(std::ostream&) const': src/r.cc:247:47: error: type qualifiers ignored on cast result type [-Werror=ignored-qualifiers] return static_cast<const R64 * const>(this)->write_att(os);
Hi all,
Returning a const value does not have much meaning, indeed CppCoreGuidelines notes:
So the second
const
in, for example: https://github.com/StanfordPL/x64asm/blob/505ab5e404d0c19a038b91b6690f85c7a087b8c6/src/r.cc#L221can be removed as
In recent version of
g++
, the compiler reports: