Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Dr Nick <3-nospam@temporary-address.org.uk> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: what is the difference between these statement |
| Date | 2012-05-09 06:54 +0100 |
| Message-ID | <87k40lucf6.fsf@temporary-address.org.uk> (permalink) |
| References | (2 earlier) <0.43422b72d7ed17378938.20120506183234BST.87sjfdgqq5.fsf@bsb.me.uk> <87mx5lxj72.fsf@temporary-address.org.uk> <0.0808dcefbdbfc7106902.20120506225240BST.878vh5geon.fsf@bsb.me.uk> <877gwowjr8.fsf@temporary-address.org.uk> <0.642417b790b5321e8920.20120507124410BST.87pqagfc6t.fsf@bsb.me.uk> |
Ben Bacarisse <ben.usenet@bsb.me.uk> writes: > Dr Nick <3-nospam@temporary-address.org.uk> writes: > <snip> >> To try to turn this into something constructive. Are there any >> circumstances in which casting the argument to a ctype function to >> unsigned char would cause problems (apart from doing it before checking >> for EOF - like "toupper(getchar())"). >> >> I can't think of one. > > I can only think of very contrived situations that rely on the > distinction between conversion and re-interpretation on machines with > odd number representations. And in these situations I think a case can > be made that the problem lies elsewhere. > > BTW, a plausible "EOF" example would be: > > int c; > while (isspace(c = getchar())); /* skip space */ Even in that case, while (isspace((unsigned char)(c = getchar()))); /* skip space */ isn't going to do any harm. 'c' still holds the uncast EOF and can be tested for later. Except in a pathological case where EOF cast to unsigned char turns into a space character I suppose - could that actually happen? -- Online waterways route planner | http://canalplan.eu Plan trips, see photos, check facilities | http://canalplan.org.uk
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
what is the difference between these statement ashu <ashishmourya21@gmail.com> - 2012-05-06 04:11 -0700
Re: what is the difference between these statement Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-05-06 12:29 +0100
Re: what is the difference between these statement ashu <ashishmourya21@gmail.com> - 2012-05-06 07:56 -0700
Re: what is the difference between these statement ashu <ashishmourya21@gmail.com> - 2012-05-06 08:01 -0700
Re: what is the difference between these statement Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-05-06 18:54 +0100
Re: what is the difference between these statement Dr Nick <3-nospam@temporary-address.org.uk> - 2012-05-06 15:39 +0100
Re: what is the difference between these statement Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-05-06 18:32 +0100
Re: what is the difference between these statement Dr Nick <3-nospam@temporary-address.org.uk> - 2012-05-06 19:23 +0100
Re: what is the difference between these statement Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-05-06 22:52 +0100
Re: what is the difference between these statement Dr Nick <3-nospam@temporary-address.org.uk> - 2012-05-07 08:08 +0100
Re: what is the difference between these statement Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-05-07 12:44 +0100
Re: what is the difference between these statement Dr Nick <3-nospam@temporary-address.org.uk> - 2012-05-09 06:54 +0100
Re: what is the difference between these statement James Kuyper <jameskuyper@verizon.net> - 2012-05-09 07:46 -0400
Re: what is the difference between these statement Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-05-09 15:32 +0100
Re: what is the difference between these statement Tim Rentsch <txr@alumni.caltech.edu> - 2012-05-09 12:02 -0700
Re: what is the difference between these statement jgk@panix.com (Joe keane) - 2012-05-10 17:46 +0000
Re: what is the difference between these statement Keith Thompson <kst-u@mib.org> - 2012-05-10 11:47 -0700
Re: what is the difference between these statement Tim Rentsch <txr@alumni.caltech.edu> - 2012-05-11 08:55 -0700
Re: what is the difference between these statement jgk@panix.com (Joe keane) - 2012-05-13 20:09 +0000
Re: what is the difference between these statement Kaz Kylheku <kaz@kylheku.com> - 2012-05-13 23:24 +0000
Re: what is the difference between these statement Tim Rentsch <txr@alumni.caltech.edu> - 2012-05-14 11:46 -0700
csiph-web