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 21:46:55
|
> -----Original Message----- > From: Per Westermark [mailto:pw...@ia...] > Sent: Thursday, April 03, 2003 1:34 AM > To: Ioannis Vranos > Cc: 'Dev-C++' > Subject: RE: [Dev-C++] itoa - atoi : another implementation > > In a lot of embedded environments, itoa() is king, because of that. If > a microcontroller have 8kB program area, itoa() consumes 100 byte and > sprintf() consumes 2kB, the choice is quite easy. My itoa() was not intended for a microcontroler. > > The above is not thread safe (since as I saw you try to > embarrass me). :) > > You must place a locking mechanism. > > That's why most implementations of itoa takes a buffer as second > parameter. But you said: > > It isn't even a good optimization of number of source code > > characters, since each call MUST be either: > > free(itoa(i1)); > > which is an expensive NOP instruction, or: Decide if you consider the free store usage expensive or not. In any case there wan't any requirement for microcontrollers. In any case you try intentionally to embarrass me. :) > www.uclibc.org (Small open clib for embedded systems) > char *itoa(int i); > note: uses static buffer That's nice, mine uses the free store, is thread safe and is intended for systems which can afford 8 kbs space cost. Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL: http://run.to/noicys |