Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: 13 year old C source code |
| Date | 2011-07-28 13:37 -0700 |
| Organization | None to speak of |
| Message-ID | <lnfwlqf8fu.fsf@nuthaus.mib.org> (permalink) |
| References | <j0sbru0am8@news4.newsguy.com> <j0sdco$6lr$1@speranza.aioe.org> <4e31b9fd$0$26852$426a74cc@news.free.fr> <j0sedl$992$1@speranza.aioe.org> |
jacob navia <jacob@spamsink.net> writes:
> Le 28/07/11 21:35, Francois Grieu a écrit :
>> On 2011/07/28 21:30, jacob navia wrote:
>>> Le 28/07/11 21:04, buck a écrit :
>>>> One of the things I'm completely stuck on is the difference in char.
>>>> In the existing source code and with C88,
>>>>
>>>> 'static char v[]={-20,-124,-180,-93,-88,-73,-27,-146,9,-38,-179 ...'
>>>>
>>>> works, but the values obviously violate current char (and unsigned
>>>> char) rules.
>>>
>>> No, this is valid code. Why should it be wrong?
>>
>> -180 -146 and -179 are less than CHAR_MIN is on anything that
>> I ever used.
>>
>> Francois Grieu
>
> So what? The compiler should take the lower 8 bits...
>
> For instance -180 should be 0x4c.
Chances are it will do so (though the standard doesn't require it,
unless plain char is unsigned). But the unanswered question is,
why did the original code use -180 in the first place?
It could well indicate a bug in the original code, having nothing
to do with K&R vs. ANSI C (perhaps it was missed because the older
compiler didn't bother to warn about it).
We really don't have enough information to do more that guess,
but if I were working on this I'd certainly try to find out.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
13 year old C source code buck <buck@private.mil> - 2011-07-28 19:04 +0000
Re: 13 year old C source code jacob navia <jacob@spamsink.net> - 2011-07-28 21:30 +0200
Re: 13 year old C source code Francois Grieu <fgrieu@gmail.com> - 2011-07-28 21:35 +0200
Re: 13 year old C source code jacob navia <jacob@spamsink.net> - 2011-07-28 21:48 +0200
Re: 13 year old C source code Keith Thompson <kst-u@mib.org> - 2011-07-28 13:37 -0700
Re: 13 year old C source code buck <buck@private.mil> - 2011-07-28 20:28 +0000
Re: 13 year old C source code Francois Grieu <fgrieu@gmail.com> - 2011-07-28 21:31 +0200
Re: 13 year old C source code Keith Thompson <kst-u@mib.org> - 2011-07-28 13:00 -0700
Re: 13 year old C source code "Scott Fluhrer" <sfluhrer@ix.netcom.com> - 2011-07-28 18:10 -0400
Re: 13 year old C source code Keith Thompson <kst-u@mib.org> - 2011-07-28 15:27 -0700
Re: 13 year old C source code Rich Webb <bbew.ar@mapson.nozirev.ten> - 2011-07-28 15:53 -0400
Re: 13 year old C source code Roberto Waltman <usenet@rwaltman.com> - 2011-07-28 16:18 -0400
Re: 13 year old C source code Roberto Waltman <usenet@rwaltman.com> - 2011-07-28 16:34 -0400
Re: 13 year old C source code Ben Pfaff <blp@cs.stanford.edu> - 2011-07-28 13:36 -0700
Re: 13 year old C source code gordonb.mgm25@burditt.org (Gordon Burditt) - 2011-07-28 15:37 -0500
Re: 13 year old C source code Robert Wessel <robertwessel2@yahoo.com> - 2011-07-28 17:33 -0500
Re: 13 year old C source code gordonb.2omx0@burditt.org (Gordon Burditt) - 2011-07-28 18:48 -0500
Re: 13 year old C source code Robert Wessel <robertwessel2@yahoo.com> - 2011-07-28 19:26 -0500
Re: 13 year old C source code BGB <cr88192@hotmail.com> - 2011-07-28 16:09 -0700
Re: 13 year old C source code Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-08-03 08:17 +0000
csiph-web