Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Willem <willem@toad.stack.nl> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Why no warning? |
| Date | 2012-06-06 13:07 +0000 |
| Organization | Stack Usenet News Service |
| Message-ID | <slrnjsulgk.2foi.willem@toad.stack.nl> (permalink) |
| References | <6d2a019d-fea9-406d-9cda-e0d77566f4e6@googlegroups.com> <chine.bleu-376D95.04532306062012@news.eternal-september.org> <0.5de67e0bec5a3be819d5.20120606132913BST.8762b4bp46.fsf@bsb.me.uk> |
Ben Bacarisse wrote:
) China Blue Max <chine.bleu@yahoo.com> writes:
)
)> In article <6d2a019d-fea9-406d-9cda-e0d77566f4e6@googlegroups.com>,
)> Hill Pang <pangbw@gmail.com> wrote:
)>
)>> I was expecting a warning for this assignment, but can't get from GCC, why?
)>> isn't it an overflow?
)>>
)>> char c = 0xff;
)>
)> Either char is implicitly unsigned or it used the conversion
)> unsigned->signed of the same size. Unless explicitly marked, the
)> implementation decides whether chars are signed; one of the default
)> conversions is unsigned to signed of the same size.
)
) Unless I've missed what you mean by "default conversions" that's a
) little confusing simply by being overly specific. C specifies implicit
) conversions between unsigned and signed types of all sizes. Some are
) defined entirely by the standard, and others are left up to the
) implementation, but there is nothing special about conversion between
) signed and unsigned integer types of the same size.
Since when is the literal 0xff an unsigned type?
As far as I can tell, it should be a signed integer, no?
SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Why no warning? Hill Pang <pangbw@gmail.com> - 2012-06-06 02:42 -0700
Re: Why no warning? Noob <root@127.0.0.1> - 2012-06-06 12:04 +0200
Re: Why no warning? Hill Pang <pangbw@gmail.com> - 2012-06-06 03:17 -0700
Re: Why no warning? James Kuyper <jameskuyper@verizon.net> - 2012-06-06 06:29 -0400
Re: Why no warning? Noob <root@127.0.0.1> - 2012-06-06 12:54 +0200
Re: Why no warning? David Brown <david@westcontrol.removethisbit.com> - 2012-06-06 12:28 +0200
Re: Why no warning? Noob <root@127.0.0.1> - 2012-06-06 12:55 +0200
Re: Why no warning? David Brown <david@westcontrol.removethisbit.com> - 2012-06-06 13:17 +0200
Re: Why no warning? Hill Pang <pangbw@gmail.com> - 2012-06-06 04:35 -0700
Re: Why no warning? James Kuyper <jameskuyper@verizon.net> - 2012-06-06 08:56 -0400
Re: Why no warning? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-06-07 15:05 +0000
Re: Why no warning? China Blue Max <chine.bleu@yahoo.com> - 2012-06-06 04:53 -0700
Re: Why no warning? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-06 13:29 +0100
Re: Why no warning? Willem <willem@toad.stack.nl> - 2012-06-06 13:07 +0000
Re: Why no warning? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-06 17:37 +0100
Re: Why no warning? Ralph Spitzner <rasp@spitzner.org> - 2012-06-06 16:57 +0200
Re: Why no warning? James Kuyper <jameskuyper@verizon.net> - 2012-06-06 11:20 -0400
Re: Why no warning? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-06-06 17:45 +0100
csiph-web