Article View: fr.comp.lang.c
Article #15662Re: Conversion int --> char
From: Antoine Leca
Date: Wed, 14 Sep 2005 16:52
Date: Wed, 14 Sep 2005 16:52
19 lines
2022 bytes
2022 bytes
En <news:43285040$0$14548$636a55ce@news.free.fr>,
Alain CROS va escriure:
> La fonction getchar retourne un int que je peux stocker dans un char
Ce n'est g�n�ralement pas une bonne id�e.
getchar() renvoie _soit_ un char (en fait un unsigned char), _soit_ EOF. Si
tu stockes dans un char au lieu d'un int, tu perds la distinction entre l'un
des caract�res possibles (typiquement �, celui qui a le code 255) et EOF.
D'autre part, sauf si tu es vraiment � court de m�moire (microprocesseur
embarqu�), stocker dans un char signifie plein d'op�rations en plus (pour
stocker mais surtout pour r�cup�rer) pour un gain de place ridicule
(�videmment, quand on parle d'un tableau de caract�res le gain devient
beaucoup plus int�ressant).
Antoine
Technical Details
Message-ID:
<dg9kfq$t7h$1@shakotay.alphanet.ch>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!solnet.ch!solnet.ch!news.imp.ch!news.imp.ch!80.83.46.147.MISMATCH!news.alphanet.ch!alphanet.ch!not-for-mailReferences:
<43285040$0$14548$636a55ce@news.free.fr>Show Full Headers
Complete Article Headers
X-Google-Thread: f9822,2c3d52d9f1b4dc77 X-Google-Attributes: gidf9822,public X-Google-Language: FRENCH,ASCII Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!solnet.ch!solnet.ch!news.imp.ch!news.imp.ch!80.83.46.147.MISMATCH!news.alphanet.ch!alphanet.ch!not-for-mail From: "Antoine Leca" <root@localhost.invalid> Newsgroups: fr.comp.lang.c Subject: Re: Conversion int --> char Date: Wed, 14 Sep 2005 18:52:09 +0200 Organization: Posted through ALPHANET (http://www.alphanet.ch/) Lines: 20 Sender: antoinel@143.red-217-127-250.pooles.rima-tde.net Message-ID: <dg9kfq$t7h$1@shakotay.alphanet.ch> References: <43285040$0$14548$636a55ce@news.free.fr> NNTP-Posting-Host: 143.red-217-127-250.pooles.rima-tde.net Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 8bit X-Trace: shakotay.alphanet.ch 1126716731 29937 217.127.250.143 (14 Sep 2005 16:52:11 GMT) X-Complaints-To: usenet@alphanet.ch NNTP-Posting-Date: Wed, 14 Sep 2005 16:52:11 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1506 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506