Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #105300
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: "usual arithmetic conversions": please explain something... |
| Date | 2017-03-01 19:08 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <87r32gn7c4.fsf@bsb.me.uk> (permalink) |
| References | (3 earlier) <o96d9b$p64$1@dont-email.me> <lnshmxc6bz.fsf@kst-u.example.com> <o96tr9$u0t$1@dont-email.me> <ln8toodhad.fsf@kst-u.example.com> <o9723r$ema$1@dont-email.me> |
BartC <bc@freeuk.com> writes:
> I found it difficult to establish whether a*b was done in signed or
> unsigned mode, without examining the result.
>
> And examining the result usually means stipulating whether it should
> be shown as signed or unsigned!
You can get C to tell you, though it's only useful while learning. It's
the kind of thing you need to know about C:
#include <stdio.h>
int main(void)
{
unsigned long a = 4000;
signed long b = -10;
puts(_Generic(a * b,
unsigned long: "unsigned long",
default: "something else"));
}
<snip>
--
Ben.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
"usual arithmetic conversions": please explain something... Lowell Gilbert <lgusenet@be-well.ilk.org> - 2017-02-28 18:33 -0500
Re: "usual arithmetic conversions": please explain something... BartC <bc@freeuk.com> - 2017-02-28 23:45 +0000
Re: "usual arithmetic conversions": please explain something... Keith Thompson <kst-u@mib.org> - 2017-02-28 16:59 -0800
Re: "usual arithmetic conversions": please explain something... Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-03-01 02:20 +0000
Re: "usual arithmetic conversions": please explain something... Keith Thompson <kst-u@mib.org> - 2017-02-28 18:51 -0800
Re: "usual arithmetic conversions": please explain something... BartC <bc@freeuk.com> - 2017-03-01 12:04 +0000
Re: "usual arithmetic conversions": please explain something... Keith Thompson <kst-u@mib.org> - 2017-03-01 08:25 -0800
Re: "usual arithmetic conversions": please explain something... BartC <bc@freeuk.com> - 2017-03-01 16:47 +0000
Re: "usual arithmetic conversions": please explain something... Keith Thompson <kst-u@mib.org> - 2017-03-01 09:43 -0800
Re: "usual arithmetic conversions": please explain something... BartC <bc@freeuk.com> - 2017-03-01 18:00 +0000
Re: "usual arithmetic conversions": please explain something... Keith Thompson <kst-u@mib.org> - 2017-03-01 10:15 -0800
Re: "usual arithmetic conversions": please explain something... Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-03-01 19:08 +0000
Re: "usual arithmetic conversions": please explain something... supercat@casperkitty.com - 2017-03-01 09:01 -0800
Re: "usual arithmetic conversions": please explain something... jameskuyper@verizon.net - 2017-02-28 15:49 -0800
Re: "usual arithmetic conversions": please explain something... Keith Thompson <kst-u@mib.org> - 2017-02-28 16:03 -0800
Re: "usual arithmetic conversions": please explain something... Nick Bowler <nbowler@draconx.ca> - 2017-03-01 21:53 +0000
Re: "usual arithmetic conversions": please explain something... Keith Thompson <kst-u@mib.org> - 2017-03-01 14:18 -0800
Re: "usual arithmetic conversions": please explain something... Lowell Gilbert <lgusenet@be-well.ilk.org> - 2017-03-01 08:29 -0500
Re: "usual arithmetic conversions": please explain something... Lowell Gilbert <lgusenet@be-well.ilk.org> - 2017-03-01 09:11 -0500
Re: "usual arithmetic conversions": please explain something... Keith Thompson <kst-u@mib.org> - 2017-03-01 08:59 -0800
Re: "usual arithmetic conversions": please explain something... scott@slp53.sl.home (Scott Lurndal) - 2017-03-01 14:00 +0000
Re: "usual arithmetic conversions": please explain something... "James R. Kuyper" <jameskuyper@verizon.net> - 2017-03-01 10:58 -0500
csiph-web