Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #73699

Re: When does the type of a character constant make a difference?

From raltbos@xs4all.nl (Richard Bos)
Newsgroups comp.lang.c
Subject Re: When does the type of a character constant make a difference?
Date 2015-10-24 15:59 +0000
Organization Go wash your mouth.
Message-ID <562baa24.10669140@news.xs4all.nl> (permalink)
References <n0g6oe$so9$1@solani.org>

Show all headers | View raw


Philipp Klaus Krause <pkk@spth.de> wrote:

> Character constants are of type int, not char in the standard (ignoring
> wide character constants, which might be of other types, such as char).
> But in which situations does this make a real difference? The only one I
> can think of now is generic selections.

AFAIAA it only makes a difference on bizarre systems where CHAR_MAX >
INT_MAX, which can only be true if char is unsigned by default _and_ at
least 16 bits large _and_ int is no larger. I don't know of any systems
where that's true, but it is theoretically possible. In fact, the first
two "if"s would be quite reasonable for an implementation which uses
Unicode (or at least, an earlier, 16-bit version thereof) for its char -
but I'd expect a system like that to have a 32-bit int at least, which
makes the problem disappear. Still - unlikely, but possible.

Richard

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

When does the type of a character constant make a difference? Philipp Klaus Krause <pkk@spth.de> - 2015-10-24 17:05 +0200
  Re: When does the type of a character constant make a difference? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-10-24 16:55 +0100
  Re: When does the type of a character constant make a difference? raltbos@xs4all.nl (Richard Bos) - 2015-10-24 15:59 +0000
  Re: When does the type of a character constant make a difference? Bartc <bc@freeuk.com> - 2015-10-24 17:16 +0100
    Re: When does the type of a character constant make a difference? Richard Damon <Richard@Damon-Family.org> - 2015-10-24 12:41 -0400
    Re: When does the type of a character constant make a difference? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-10-24 17:50 +0100
    Re: When does the type of a character constant make a difference? Keith Thompson <kst-u@mib.org> - 2015-10-24 13:05 -0700
      Re: When does the type of a character constant make a difference? Bartc <bc@freeuk.com> - 2015-10-24 22:09 +0100
        Re: When does the type of a character constant make a difference? Nobody <nobody@nowhere.invalid> - 2015-10-26 06:15 +0000
          Re: When does the type of a character constant make a difference? raltbos@xs4all.nl (Richard Bos) - 2015-10-26 09:07 +0000

csiph-web