RE: [Dev-C++] itoa - atoi : another implementation
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <iv...@em...> - 2003-04-02 20:46:25
|
> -----Original Message----- > From: Per Westermark [mailto:pw...@ia...]=20 > Sent: Wednesday, April 02, 2003 9:44 PM > To: Ioannis Vranos > Cc: 'Dev-C++' > Subject: RE: [Dev-C++] itoa - atoi : another implementation=20 >=20 >=20 > The most common is one of the following declarations: > void itoa(int num, char *buf, int base); > void itoa(int num, char *buf); >=20 > Neither have problem with lost memory, and both are reentrant. >=20 > The first form is always useful, since it allows adjustable=20 > number base, > i.e. binary, trinary, ... I had written some time ago an unsigned to string conversion function in = any number system. But after some time I erased it because except of = hexadecimal and octadecimal systems, it is very rare to use trinary etc in a = program. And for hex and oct we can do the job with the printf() family. > The second form is only needed in embedded programs, since it requires > less RTL support than the big-big-big sprintf() - note that sprintf() > doesn't know whet additional support that is required, so it=20 > has code for > left-adjust, right-adjust, int, long, signed, unsigned,=20 > string, pointer, > float, double, ... I haven't played with embedded systems, but for usual ones I consider = the horsepower/memory enough so as to have the entire C90. I think that if a system can't hold C90, it can only be programmed with assembly. Memory = is very cheap these days. For example one could place an intel processor = with 1 mb ram easily in an embedded system (e.g. just a 286 or some of the = intel processors used for palmtops etc, or from other companies). Ioannis Vranos =20 * Programming pages: http://www.noicys.freeurl.com * Alternative URL: http://run.to/noicys |