]> www.ginac.de Git - ginac.git/commit
Avoid "expression with side effects..." warning using ex_to<T>().
authorRichard Kreckel <kreckel@ginac.de>
Mon, 25 Nov 2024 23:21:28 +0000 (00:21 +0100)
committerRichard Kreckel <kreckel@ginac.de>
Mon, 25 Nov 2024 23:33:32 +0000 (00:33 +0100)
commit32702f847fb49da649f4362b0de3084890ac8129
tree9fbe82c17dec819ebab4fc33efd2cd263517a955
parent0aa0a0c6fe7d24fdc41af01581e8728054393740
Avoid "expression with side effects..." warning using ex_to<T>().

Clang++ warns that instantiations of this inline template function
ex_to<T>(const ex &) are "expression with side effects [that] will be
evaluated despite being used as an operand to 'typeid'".

Let's declare this ex_to<T>() as a pure function (i.e. having no
side effects) for compilers which support __attribute__((__pure__)).

GCC seems to support this attribute since more than ten years.
ginac/compiler.h
ginac/ex.h