On Mon, 29 Jun 2020, Erick Ochoa wrote:

> We are not targeting C++ at the moment. What contexts exist in C where we
> require constant expressions? On the top of my head I have array sizes and
> initialization of static variables? In such cases, then yes we agree that we

Bit-field widths, static assertions, array designators in initializers, 
values in enum declarations, case labels, ....

It's not always possible to determine the type of an expression without 
knowing the values of constant expressions within it.  An integer constant 
expression cast to (void *) is a null pointer constant if it has value 0, 
but not if it has another value.  Now look at the rules for the type of 
conditional expressions between two pointers, which depend on whether one 
is a null pointer constant.  glibc's <tgmath.h> uses that when building 
with older compilers.  GNU __builtin_choose_expr yields simpler cases 
where a type depends on the value of an integer constant expression.

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to