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


Groups > comp.lang.c > #22816

Re: Bitwise Not Operator

Message-ID <4FEA0621.8060707@loria.fr> (permalink)
Date 2012-06-26 20:57 +0200
From Jens Gustedt <jens.gustedt@loria.fr>
Newsgroups comp.lang.c
Subject Re: Bitwise Not Operator
References <5baf9e7b-f46f-4aad-9e44-aa4c12cb0041@googlegroups.com> <slrn3vfsjujqvp.jur.ike@iceland.freeshell.org> <12aac795-58c8-4810-b017-4034c655bf50@googlegroups.com>
Organization Guest of ProXad - France

Show all headers | View raw


Am 26.06.2012 20:40, schrieb aleksa:
> On Tuesday, June 26, 2012 7:06:01 PM UTC+2, Ike Naar wrote:
>> On 2012-06-26, aleksa <aleksazr@gmail.com> wrote:
>>> unsigned char X, Y;
>>> if (X != (unsigned char) ~Y)
>>>
>>> why do I get a warning here?
>>> comparison of promoted ~unsigned with unsigned

> but, aren't both values here unsigned?

no, Y is promoted to int before the ~ is applied, then ~Y is int, too

all types that have an integer rank lower than int are promoted to int
(or on rare architectures to unsigned) before any operator is applied

Jens




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


Thread

Bitwise Not Operator aleksa <aleksazr@gmail.com> - 2012-06-26 08:35 -0700
  Re: Bitwise Not Operator Ike Naar <ike@iceland.freeshell.org> - 2012-06-26 17:06 +0000
    Re: Bitwise Not Operator aleksa <aleksazr@gmail.com> - 2012-06-26 11:40 -0700
      Re: Bitwise Not Operator Jens Gustedt <jens.gustedt@loria.fr> - 2012-06-26 20:57 +0200
      Re: Bitwise Not Operator James Kuyper <jameskuyper@verizon.net> - 2012-06-26 15:17 -0400
  Re: Bitwise Not Operator Les Cargill <lcargill99@comcast.com> - 2012-06-26 12:31 -0500

csiph-web