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


Groups > comp.lang.c > #22811

Re: Bitwise Not Operator

From Ike Naar <ike@iceland.freeshell.org>
Newsgroups comp.lang.c
Subject Re: Bitwise Not Operator
Date 2012-06-26 17:06 +0000
Organization A noiseless patient Spider
Message-ID <slrn3vfsjujqvp.jur.ike@iceland.freeshell.org> (permalink)
References <5baf9e7b-f46f-4aad-9e44-aa4c12cb0041@googlegroups.com>

Show all headers | View raw


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

This is unexpected.
Looking a the format of the warning, it seems you're using gcc.
But gcc 4.1.2 only gives this warning when the cast to unsigned char
is missing, as in (X != ~Y). If the cast is in place, the compiler
remains silent. Which version of gcc do you use?

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