https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90081

--- Comment #2 from Guy Perfect <bafap5 at yahoo dot com> ---
The issue is not resolved based on the merits of the out-of-range values used
in the earlier examples. Type resolution still fails in the current
implementation, as demonstrated below:

  int x = sizeof ((int8_t) 5); /* Correct, gives 1 */
  int y = sizeof (INT8_C(5));  /* Incorrect, gives 4 */

In this case, INT8_C is required to evaluate to type int_least8_t, which cannot
be larger than the smallest integer type able to represent the range of the
type int8_t:

"The typedef name int_least N _t designates a signed integer type with a width
of at least N, such that no signed integer type with lesser size has at least
the specified width."

int8_t can be represented exactly using 1 byte, as shown by the cast. For the
sizeof test to give 4 on the macro demonstrates that the macro is implemented
incorrectly.

A cast is still strongly encouraged (if not necessary) in order for these
macros to be compliant with the stdint.h specification.

Reply via email to