Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Underlying type of character constants and \"plain char
#3
Please clarify. ISO/IEC 9899:1999 C standard considers plain char type an \"integer type\":

Quote:The type char, the signed and unsigned integer types, and the enumerated types are collectively called integer types.

Is my understanding correct, that we don't consider character constants an \"integer type\"?

So this is also not a violation of 10.1 rule:
Code:
unsigned int c = 'x';  /* Not a \"conversion from signed to unsigned\" violation? */

I understand we still consider variables of signed/unsigned/plain char types as a \"integer types\"?

Code:
void foo(int x) {
  unsigned int c = x;  /* Violation: conversion from signed to unsigned. */
}


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)