Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » AVR-GCC
  • » [avr-gcc-list] Poll: Who uses itoa() & co with base != {2, 8, 10, 16}? [RSS Feed]

#1 Nov. 18, 2005 20:29:29

Joerg W.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] Poll: Who uses itoa() & co with base != {2, 8, 10, 16}?


Dmitry Xmelkov provided speed-improved versions of itoa() & Co. that
no longer use standard division functions for formatting:https://savannah.nongnu.org/patch/?func=detailitem&item_id=3729The only drawback of that approach is that its use will restrict the
posible base of these functions to either 2, 8, 10, or 16.

I tend to see this as benign, as I cannot imagine why anyone would
want to print out numbers base 7 or base 13, so I'm inclined to
replace the existing itoa() family by Dmitry's submission. When doing
so, I'll probably rename the existing implementations to itoa_full()
etc. to preserve them in case anyone really needs that functionality.

While itoa() is not really standardized in any way (at least not for
C, I'm not sure for C++), it is commonly implemented with a possible
base of , so changing that would constitute an API change.

Opinions?

--
cheers, J"org .-.-. --... ...-- -.. . DL8DTLhttp://www.sax.de/~joerg/NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)



_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Offline

#2 Nov. 18, 2005 20:52:22

Joerg W.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] Poll: Who uses itoa() & co with base != {2, 8, 10, 16}?


As Alan Kilian wrote:

> My opinion is that you do a fantastic job helping to maintain
> a tool that makes my life a thousand percent easier, and you
> deserve great rewards.

Thank you!

> Do you have a PayPal account so that I can send you a donation
> for all your hard work?

Ah, no, c'mon. I've got a pay job, and this is just the fun stuff.
Let's keep them separate.

--
cheers, J"org .-.-. --... ...-- -.. . DL8DTLhttp://www.sax.de/~joerg/NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)



_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Offline

#3 Nov. 18, 2005 23:56:05

Daniel O.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] Poll: Who uses itoa() & co with base != {2, 8, 10, 16}?


On Sat, 19 Nov 2005 07:22, Joerg Wunsch wrote:
> > Do you have a PayPal account so that I can send you a donation
> > for all your hard work?
>
> Ah, no, c'mon. I've got a pay job, and this is just the fun stuff.
> Let's keep them separate.

You could use it as beer money ;)

--
Daniel O'Connor software and network engineer
for Genesis Software -http://www.gsoft.com.au"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8CpgpSljOkLv6KM.pgpDescription:PGP signature_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Attachments:
attachment pgpSljOkLv6KM.pgp (187 bytes)

Offline

#4 Nov. 19, 2005 02:07:20

Parthasaradhi N.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] Poll: Who uses itoa() & co with base != {2, 8, 10, 16}?


Joerg Wunsch <>wrote:When doingso, I'll probably rename the existing implementations to itoa_full()etc. to preserve them in case anyone really needs that functionality.Opinions?This is a good suggestion. If anybody wants other base conversion, itoa_full() is any way going to be there.RegardsNayaniYahoo! FareChase - Search multiple travel sites in one click._______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Offline

#5 Nov. 19, 2005 06:42:01

Anton E.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] Poll: Who uses itoa() & co with base != {2, 8, 10, 16}?


On 18 Nov 2005 at 21:29, Joerg Wunsch wrote:

> Dmitry Xmelkov provided speed-improved versions of itoa() & Co. that
> no longer use standard division functions for formatting:
>
>https://savannah.nongnu.org/patch/?func=detailitem&item_id=3729>
> The only drawback of that approach is that its use will restrict the
> posible base of these functions to either 2, 8, 10, or 16.
>
> I tend to see this as benign, as I cannot imagine why anyone would
> want to print out numbers base 7 or base 13, so I'm inclined to
> replace the existing itoa() family by Dmitry's submission. When doing
> so, I'll probably rename the existing implementations to itoa_full()
> etc. to preserve them in case anyone really needs that functionality.
>
> While itoa() is not really standardized in any way (at least not for
> C, I'm not sure for C++), it is commonly implemented with a possible
> base of , so changing that would constitute an API change.
>
> Opinions?
>

I think it would be a good move. In most C libraries the itoa function is
extremely slow because it caters for all bases from 2 to 36. I think having
a library compile option that compiles the full version in stead of the faster
version would be better than renaming it. Default build uses the fast routines,
and if someone wants the full version, they can recompile with that option
selected.

Regards
Anton Erasmus--
A J Erasmus



_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Offline

#6 Nov. 19, 2005 07:21:25

Joerg W.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] Poll: Who uses itoa() & co with base != {2, 8, 10, 16}?


As Anton Erasmus wrote:

> > ..., so I'm inclined to replace the existing itoa() family by
> > Dmitry's submission. When doing so, I'll probably rename the
> > existing implementations to itoa_full() etc. to preserve them in
> > case anyone really needs that functionality.

> > Opinions?

> I think it would be a good move. In most C libraries the itoa
> function is extremely slow because it caters for all bases from 2 to
> 36. I think having a library compile option that compiles the full
> version in stead of the faster version would be better than renaming
> it.

I'd rather use something like

#define _USE_FULL_ITOA
#include <stdlib.h>

... itoa(x, s, 13);

--
cheers, J"org .-.-. --... ...-- -.. . DL8DTLhttp://www.sax.de/~joerg/NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)



_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Offline

#7 Nov. 19, 2005 12:15:06

Anton E.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] Poll: Who uses itoa() & co with base != {2, 8, 10, 16}?


On 19 Nov 2005 at 7:57, Joerg Wunsch wrote:

> As Anton Erasmus wrote:
>
> > > ..., so I'm inclined to replace the existing itoa() family by
> > > Dmitry's submission. When doing so, I'll probably rename the
> > > existing implementations to itoa_full() etc. to preserve them in
> > > case anyone really needs that functionality.
>
> > > Opinions?
>
> > I think it would be a good move. In most C libraries the itoa
> > function is extremely slow because it caters for all bases from 2 to
> > 36. I think having a library compile option that compiles the full
> > version in stead of the faster version would be better than renaming
> > it.
>
> I'd rather use something like
>
> #define _USE_FULL_ITOA
> #include <stdlib.h>
>
> ... itoa(x, s, 13);
>

Yes,

As long as one always use itoa, and not have to change one's
source to call itoa_full if one needs some other base. And of course
as long as only the actual version used gets linked.

Regards
Anton Erasmus
--
A J Erasmus



_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Offline

#8 Nov. 19, 2005 14:04:18

Rolf E.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] Poll: Who uses itoa() & co with base != {2, 8, 10, 16}?


The only drawback of that approach is that its use will restrict the
posible base of these functions to either 2, 8, 10, or 16.

Opinions?I am in favor of a fast and restricted itoa as the default. Even more soif you still provide the full implementation by a simple compile timeswitch.Rolf


_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Offline

#9 Nov. 22, 2005 21:34:38

Nigel W.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] Poll: Who uses itoa() & co with base != {2, 8, 10, 16}?


> In French we say "L'enfer est pavé de bonnes intentions".
> (The hell is paved good intentions (google translation?))

Google messed it up; The english phrase is:

"The road to hell is paved with good intentions"


> I vote for something like itoa_fast() and have itoa() keeps its old
> features.
>
> Bernard

If anyone is counting votes then mine is to support Bernard, keep itoa as is
but introduce a restricted replacement with a new name.


Nigel Winterbottom



_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Offline

  • Root
  • » AVR-GCC
  • » [avr-gcc-list] Poll: Who uses itoa() & co with base != {2, 8, 10, 16}? [RSS Feed]

Board footer

Moderator control

Enjoy the 23rd of April
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support