Article View: comp.lang.c.moderated
Article #2132Re: Why Use 'Int' Instead of 'Long'? (With today's compilers)
From: J. Kanze
Date: Fri, 01 Mar 1996 15:34
Date: Fri, 01 Mar 1996 15:34
43 lines
2271 bytes
2271 bytes
In article <4gjd8a$o2e@solutions.solon.com> danpop@mail.cern.ch (Dan
Pop) writes:
|> In <4givf4$lak@solutions.solon.com> kanze@gabi-soft.fr (J. Kanze) writes:
|> :It must be defined as something that getchar cannot return otherwise.
|> Why?
Because the implementation is unusable otherwise:-)?
You are right. All the standard says is that getchar returns `the next
character (if present) as an unsigned char converted to an int'. If the
value of the `unsigned char' does not fit into an int, then the
conversion is implementation defined.
This could cause definite problems on a 16 bit machine using 16 bit
char's (Unicode), especially if the implementation decided to do
something exotic for the implementation defined bit.
|> :If char is 32 bits, and all values may really be read from disk, then a
|> :conforming implementation will have to have to have an int that is
|> :larger than 32 bits, in order to handle the above correctly.
|> Or the above has to be rewritten to take into account the possibility
|> that EOF can be the same as a valid character. Trivial, but not
|> particularly elegant.
Correct, but horrible.
|> :Or else,
|> :it would simply have to bill itself as an unhosted implementation, and
|> :be freed from any requirements in the library area.
|> What requirements in the library area are you talking about?
|> Chapter and verse, please.
I was wrong.
--
James Kanze (+33) 88 14 49 00 email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs Bourgeois, 67000 Strasbourg, France
Conseils, études et réalisations en logiciel orienté objet --
-- A la recherche d'une activité dans une region francophone
Technical Details
Message-ID:
<4h75e5$4p2@solutions.solon.com>Path:
arc1-ca.pugleaf.net!solon.com!not-for-mailReferences:
<4fjk00$nss@solutions.solon.com> <4fu7tj$9a1@solutions.solon.com> <4g54nt$aih@solutions.solon.com> <4gf916$1dk@solutions.solon.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail From: kanze@gabi-soft.fr (J. Kanze) Newsgroups: comp.lang.c.moderated Subject: Re: Why Use 'Int' Instead of 'Long'? (With today's compilers) Date: 1 Mar 1996 09:34:29 -0600 Organization: GABI Software, Sarl. Sender: clc@solutions.solon.com Approved: clc@solutions.solon.com Message-ID: <4h75e5$4p2@solutions.solon.com> References: <4fjk00$nss@solutions.solon.com> <4fu7tj$9a1@solutions.solon.com> <4g54nt$aih@solutions.solon.com> <4gf916$1dk@solutions.solon.com> NNTP-Posting-Host: solutions.solon.com