Article View: comp.sys.mac
Article #25732Re: LightSpeed C 2.15 putchar fix, hope done in LSC3.0, etc.
From: Chris Schanzle
Date: Sat, 27 Feb 1988 17:16
Date: Sat, 27 Feb 1988 17:16
38 lines
2120 bytes
2120 bytes
In article <413@white.gcm>, dc@gcm (Dave Caswell) writes:
> )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.
> "dc@gcm" writes (sorry, no name available & I couldn't mail)
> I trust K&R The C Programming Language. I quote p. 184
> "First, any operands of type char or short are converted to int ..."
True, this is the "bible" of programming, but I think you are trying
to compare apples and oranges here. He was discussing about passing
char and int ARGUMENTS - whether or not they automatically get casted
into ints or not. Your quotation surprised me, and I looked it up on
p. 184. It is under the subheading of "Arithmetic conversions" - this
is not the same thing as passing arguments to functions! K&R are saying
something like:
char c = 3;
short x = 2;
int result;
result = x + c;
Here, the variables x and c are converted to integers BEFORE the arithmetic
is done.
> This is the language definition.
The *arithmetic* conversions are!
_____________________
ARPA : chris@umbc3.UMD.EDU BITNET : chris@umbc
"He was betrayed by the limits of his own potential."
--
ARPA : chris@umbc3.UMD.EDU BITNET : chris@umbc
"He was betrayed by the limits of his own potential."
Technical Details
Message-ID:
<817@umbc3.UMD.EDU>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!decvax!purdue!umd5!umbc3!chrisReferences:
<6813@drutx.ATT.COM> <6814@drutx.ATT.COM> <413@white.gcm>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!decvax!purdue!umd5!umbc3!chris From: chris@umbc3.UMD.EDU (Chris Schanzle) Newsgroups: comp.sys.mac Subject: Re: LightSpeed C 2.15 putchar fix, hope done in LSC3.0, etc. Message-ID: <817@umbc3.UMD.EDU> Date: 27 Feb 88 17:16:34 GMT References: <6813@drutx.ATT.COM> <6814@drutx.ATT.COM> <413@white.gcm> Organization: Univ of Maryland Baltimore County Lines: 38 Summary: Parameter passing, not arithmetic conversions!