Constant expressions and cvalues - Printable Version +- MISRA Discussion Forums (https://forum.misra.org.uk) +-- Forum: MISRA C++ (https://forum.misra.org.uk/forumdisplay.php?fid=18) +--- Forum: MISRA C++:2008 rules (https://forum.misra.org.uk/forumdisplay.php?fid=19) +---- Forum: 6.5 Expressions (C++) (https://forum.misra.org.uk/forumdisplay.php?fid=134) +---- Thread: Constant expressions and cvalues (/showthread.php?tid=1365) |
Constant expressions and cvalues - abgs - 11-09-2017 The description of cvalue expressions in section 6 uses the phrase "constant integral expressions" while citing the C++ standard section on constant expressions which does not contain the quoted phrase. Is "constant integral expressions" intended to say "integral constant expression", or does "constant integral expression" refer to a distinct concept? Below, under the heading "Constant expressions", rules for "a constant expression" are defined in terms of the value of an integer literal. Not all "constant expressions" are integer values, e.g. the address-of operator can produce a "constant expression" of pointer type (but is not an "integral constant expression"), and it does not make sense to speak an integer literal having a pointer value. Is the use of unqualified "constant expression" here intended to have some missing "integral" qualification, or to continue referring to the "constant integral expressions" used earlier? "Constant expressions" involving floating point arithmetic are not considered "integral constant expressions" but are "arithmetic constant expressions" (whereas "integral constant expressions" may contain floating literals if they are immediately cast to an integer type). Is an "arithmetic constant expression" that is not an "integral constant expression" considered a "constant integral expression" for the purposes of determining whether an expression is or is not a cvalue? Is an "arithmetic constant expression" considered a "constant expression" [presumably with a missing "integral" somewhere"] for the purposes of the "Constant expressions" heading even though it is not an "integral constant expression"? Re: Constant expressions and cvalues - misra cpp - 22-09-2017 "constant integral expression" and "integral constant expression" are synonymous The section on underlying types only relates to integer values - though this not not be sufficiently explained. It will be clarified in the next version |