Article View: net.lang.c
Article #9299Char vs. Int
From: Jay Mathew Libove
Date: Sat, 13 Sep 1986 08:18
Date: Sat, 13 Sep 1986 08:18
24 lines
1031 bytes
1031 bytes
I have always been under the impression that a CHAR variable and an INT variable
were the same in 'C'- yet I now see:
Message-Id: <1219@drutx.UUCP>
Date: 8 Sep 86 02:52:47 GMT
To: info-c@brl-smoke.arpa
In the sequence:
main()
{
char c = 'w';
foo(c)
}
foo(ch)
char ch;
char ch is the correct declaration. The compiler/code generator should
handle pulling the character portion of the promoted variable off the
stack correctly. Declaring it 'int' is asking for trouble.
Why is it asking for trouble to declare ch as INT when K&R says they are the
same?
Technical Details
Message-ID:
<3770@brl-smoke.ARPA>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!brl-adm!brl-smoke!smoke!jl42@andrew.cmu.eduShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!brl-adm!brl-smoke!smoke!jl42@andrew.cmu.edu From: jl42@andrew.cmu.edu (Jay Mathew Libove) Newsgroups: net.lang.c Subject: Char vs. Int Message-ID: <3770@brl-smoke.ARPA> Date: Sat, 13-Sep-86 04:18:38 EDT Article-I.D.: brl-smok.3770 Posted: Sat Sep 13 04:18:38 1986 Date-Received: Sat, 13-Sep-86 09:51:43 EDT Sender: news@brl-smoke.ARPA Lines: 24