Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed101.telia.com!starscream.dk.telia.net!news.tele.dk!feed118.news.tele.dk!not-for-mail Newsgroups: comp.lang.c++ Subject: Re: Conversion of a number from string to vector References: <4dfd93f0$0$2848$7b1e8fa0@news.nbl.fi> <4dfee42a$0$2831$7b1e8fa0@news.nbl.fi> <968gfuFsmeU5@mid.individual.net> From: Lasse Reichstein Nielsen Date: Mon, 20 Jun 2011 22:47:04 +0200 Message-ID: <7h8gz0vr.fsf@gmail.com> User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Rational FORTRAN, windows-nt) Cancel-Lock: sha1:RJFfbim8VYnk/5Wxbs3BEB2KNrI= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Lines: 30 Organization: TDC Totalloesninger NNTP-Posting-Host: 87.57.52.80 X-Trace: 1308602842 dtext01.news.tele.dk 36579 87.57.52.80:45372 X-Complaints-To: abuse@post.tele.dk Xref: x330-a1.tempe.blueboxinc.net comp.lang.c++:6978 "Paul" writes: > I see some people are using the subtraction of char '0' technique, but > this seems a bit weird to me as chars are not supposed to behave like > that.. Like what? The char type is an integral type. You can subtract them just fine. > IIRC there is something in the standard about the chars '0' - '9' > having special pirvaleges with arithmetic operators. I doubt that. > Does the following char arithmetic work? > > '4' * '2' No, unless you want the result to be 2600. > Will give us an integer value of 8? Sorry too lazy to check, I m > having my morning tea :) Not 8, no. /L -- Lasse Reichstein Holst Nielsen DHTML Death Colors: 'Faith without judgement merely degrades the spirit divine.'