Article View: comp.sys.mac
Article #25677Re: LightSpeed C 2.15 putchar fix,
From: dorner
Date: Wed, 24 Feb 1988 15:21
Date: Wed, 24 Feb 1988 15:21
36 lines
2180 bytes
2180 bytes
My apologies to the uninterested; this discussion probably belongs in
comp.lang.C, but I don't like the spread of misinformation in comp.sys.mac.
>Nontheless, I think it's very important that this usage and the reasons
>be well understood, not glossed over with the 'most C compilers promote
^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
>passed char arguments to ints anyway'. VERY bad practice to depend on
^^^^^^^^^^^^^^^^^
>anything of the sort; it's the sort of foolishness that makes people
>hate C and its programmers. And it's completely un-necessary.
>Makes a lot more sense just to do things right.
As I pointed out before, this is *HOGWASH*. K&R specifically guarantee the
behavior, and not as a quirk, but as in integral part of the language.
All chars in expressions are widened to ints! As K&R point out, this
is marvellous behavior. Since function arguments (like just about
everything else in C) are expressions, chars in them are widened to ints.
>When you get to C++, the world changes again, and though some
>promotions remain, and others are added, there is a real mire pit
>waiting if you try to make things work by such 'inner' details.
>Trust me on this one.
Since I don't use C++, I'll have to trust you. But if it is different
from C in such a fundamental manner, I'm not sure I will ever use C++.
>Declare and use data types consistently, is an easy and enjoyable way.
No argument there.
>Clive Steward
----
Steve Dorner, U of Illinois Computing Services Office
Internet: dorner@uxc.cso.uiuc.edu UUCP: ihnp4!uiucuxc!dorner
IfUMust: (217) 333-3339
Technical Details
Message-ID:
<174400103@uxc.cso.uiuc.edu>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!lll-winken!lll-lcc!lll-tis!ames!hao!gatech!purdue!i.cc.purdue.edu!j.cc.purdue.edu!pur-ee!uiucdcs!uxc.cso.uiuc.edu!dornerReferences:
<6814@drutx.ATT.COM>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!lll-winken!lll-lcc!lll-tis!ames!hao!gatech!purdue!i.cc.purdue.edu!j.cc.purdue.edu!pur-ee!uiucdcs!uxc.cso.uiuc.edu!dorner From: dorner@uxc.cso.uiuc.edu Newsgroups: comp.sys.mac Subject: Re: LightSpeed C 2.15 putchar fix, Message-ID: <174400103@uxc.cso.uiuc.edu> Date: 24 Feb 88 15:21:00 GMT References: <6814@drutx.ATT.COM> Lines: 35 Nf-ID: #R:drutx.ATT.COM:6814:uxc.cso.uiuc.edu:174400103:000:1651 Nf-From: uxc.cso.uiuc.edu!dorner Feb 24 09:21:00 1988