Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail |
|---|---|
| NNTP-Posting-Date | Wed, 12 Oct 2011 20:12:04 -0500 |
| Message-ID | <4E963AE4.6090@mindspring.com> (permalink) |
| Date | Wed, 12 Oct 2011 21:12:04 -0400 |
| From | pete <pfiland@mindspring.com> |
| Reply-To | pfiland@mindspring.com |
| Organization | PF |
| X-Mailer | Mozilla 3.04Gold (WinNT; I) |
| MIME-Version | 1.0 |
| Newsgroups | comp.lang.c |
| Subject | Re: unsigned == signed ? |
| References | <j72687$bcn$1@speranza.aioe.org> <j72979$j2n$1@speranza.aioe.org> <lnlisrtdp6.fsf@nuthaus.mib.org> <j74dr1$kus$1@speranza.aioe.org> |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| Lines | 41 |
| X-Usenet-Provider | http://www.giganews.com |
| NNTP-Posting-Host | 4.154.221.123 |
| X-Trace | sv3-M3BCnfv85aboCJK6GXwRcBER+cyBekR9P7D2u7qKHBRiW0eDM+zIiXgYf0Nu+U+2FLs7bYH1wWCTgSp!rAVywZPi6x5GmZH9+RH9905rVC8ECu32AKxLOTUEJUdvECA+KKLtzUKYycraHw8CZr0wiQrirSke!uQ9dd98oHos= |
| X-Abuse-and-DMCA-Info | Please be sure to forward a copy of ALL headers |
| X-Abuse-and-DMCA-Info | Otherwise we will be unable to process your complaint properly |
| X-Postfilter | 1.3.40 |
| X-Original-Bytes | 1840 |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.c:11603 |
Show key headers only | View raw
Quentin Pope wrote:
> true, my mistake.
> however the values are converted first. to prove it, try this
> long x = -1; /* (32 bit, signed) */
> unit y = -1; /* (16 bit, unsigned) */
> if (x == y) printf("EQUAL");
> will print EQUAL !
Here's what I get for output:
/* BEGIN output from new.c */
NOT!!!
/* END output from new.c */
And here's the program:
/* BEGIN new.c */
#include <stdio.h>
int
main(void)
{
long x = -1;
unsigned char y = -1;
puts("\n/* BEGIN output from new.c */");
if (x == y) {
puts("EQUAL");
} else {
puts(" NOT!!!");
}
puts("/* END output from new.c */");
return 0;
}
/* END new.c */
--
pete
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
unsigned == signed ? Raj Pashwar <raj121190@hotmail.NOSPAM.com> - 2011-10-11 19:43 +0000
Re: unsigned == signed ? Keith Thompson <kst-u@mib.org> - 2011-10-11 12:57 -0700
Re: unsigned == signed ? James Kuyper <jameskuyper@verizon.net> - 2011-10-11 16:23 -0400
Re: unsigned == signed ? Quentin Pope <qp19433@hotmail.NOSPAM.com> - 2011-10-11 20:33 +0000
Re: unsigned == signed ? James Kuyper <jameskuyper@verizon.net> - 2011-10-11 16:40 -0400
Re: unsigned == signed ? Keith Thompson <kst-u@mib.org> - 2011-10-11 14:34 -0700
Re: unsigned == signed ? Quentin Pope <qp19433@hotmail.NOSPAM.com> - 2011-10-12 16:04 +0000
Re: unsigned == signed ? Keith Thompson <kst-u@mib.org> - 2011-10-12 10:49 -0700
Re: unsigned == signed ? pete <pfiland@mindspring.com> - 2011-10-12 21:12 -0400
Re: unsigned == signed ? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-10-11 22:35 +0100
Re: unsigned == signed ? Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-10-13 14:54 +0300
Re: unsigned == signed ? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-10-13 15:26 +0100
Re: unsigned == signed ? "J. J. Farrell" <jjf@bcs.org.uk> - 2011-10-12 03:02 +0100
Re: unsigned == signed ? Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-10-13 13:56 +0300
csiph-web