RE: [avr-libc-dev] Re: Request for cbrt() and strdup to be addedtolibc

2008-06-22 Thread Weddington, Eric
> -Original Message- > From: > [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > org] On Behalf Of Joerg Wunsch > Sent: Sunday, June 22, 2008 10:16 PM > To: avr-libc-dev@nongnu.org > Subject: Re: [avr-libc-dev] Re: Request for cbrt() and strdup > to be addedtolibc > > As Weddington, Er

Re: [avr-libc-dev] Re: Request for cbrt() and strdup to be addedtolibc

2008-06-22 Thread Joerg Wunsch
As Weddington, Eric wrote: > > I always use "if(!copy)..." > > That doesn't make it right. In a purely technical sense, it's right. It's just a question of style whether to explicitly write the test against NULL, and I've seen several style guide requesting so. -- cheers, J"org

Re: [avr-libc-dev] [bug #23677] Request for cbrt() and strdup to be added to libc

2008-06-22 Thread Blake Leverett
On Sunday 22 June 2008, Russell Shaw wrote: > I *never* use straight fp equality in code (x==0.0 baaad). > > http://c-faq.com/fp/fpequal.html > http://c-faq.com/fp/strangefp.html In the references you gave, they use if (x == 0.0) in the example code. IEEE floats and doubles both define 0.0 as a

Re: [avr-libc-dev] [bug #23677] Request for cbrt() and strdup to be added to libc

2008-06-22 Thread Russell Shaw
Russell Shaw wrote: Andy Hutchinson wrote: URL: Summary: Request for cbrt() and strdup to be added to libc Project: AVR C Runtime Library Submitted by: hutchinsonandy Submitted on: Sunday 06/2

Re: [avr-libc-dev] [bug #23677] Request for cbrt() and strdup to be added to libc

2008-06-22 Thread Russell Shaw
Russell Shaw wrote: Andy Hutchinson wrote: URL: Summary: Request for cbrt() and strdup to be added to libc Project: AVR C Runtime Library Submitted by: hutchinsonandy Submitted on: Sunday 06/2

RE: [avr-libc-dev] Re: Request for cbrt() and strdup to be addedtolibc

2008-06-22 Thread Weddington, Eric
> -Original Message- > From: > [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > org] On Behalf Of Russell Shaw > Sent: Sunday, June 22, 2008 8:48 PM > Cc: avr-libc-dev@nongnu.org > Subject: Re: [avr-libc-dev] Re: Request for cbrt() and strdup > to be addedtolibc > > >>if (copy ==

Re: [avr-libc-dev] Re: Request for cbrt() and strdup to be added tolibc

2008-06-22 Thread Russell Shaw
Weddington, Eric wrote: -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] org] On Behalf Of Joerg Wunsch Sent: Sunday, June 22, 2008 2:09 PM To: avr-libc-dev@nongnu.org Subject: Re: [avr-libc-dev] Re: Request for cbrt() and strdup to be added tolibc As Andy H w

Re: [avr-libc-dev] [bug #23677] Request for cbrt() and strdup to be added to libc

2008-06-22 Thread Russell Shaw
Andy Hutchinson wrote: URL: Summary: Request for cbrt() and strdup to be added to libc Project: AVR C Runtime Library Submitted by: hutchinsonandy Submitted on: Sunday 06/22/2008 at 21:51

[avr-libc-dev] [bug #23677] Request for cbrt() and strdup to be added to libc

2008-06-22 Thread Andy Hutchinson
URL: Summary: Request for cbrt() and strdup to be added to libc Project: AVR C Runtime Library Submitted by: hutchinsonandy Submitted on: Sunday 06/22/2008 at 21:51 Category: Featu

Re: [avr-libc-dev] Re: Request for cbrt() and strdup to be added to libc

2008-06-22 Thread Joerg Wunsch
As Joerg Wunsch wrote: > However, that's only half of the story, and the other half is > frequently forgotten about by people sending patches (and wondering > why it takes forever to integrate them): the documentation is > missing. Actually, it's only a third of the story. Documentation being th

Re: [avr-libc-dev] Re: Request for cbrt() and strdup to be addedtolibc

2008-06-22 Thread Joerg Wunsch
As Weddington, Eric wrote: > IIRC, there's some other (obscure) backend in GCC where NULL != > 0. So I believe it is possible, though admittedly rare. Quite possible, but the C standard requires that a numerical zero will be automatically converted into a null pointer when being used in a pointer

RE: [avr-libc-dev] Re: Request for cbrt() and strdup to be addedtolibc

2008-06-22 Thread Weddington, Eric
> -Original Message- > From: > [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > org] On Behalf Of Joerg Wunsch > Sent: Sunday, June 22, 2008 2:35 PM > To: avr-libc-dev@nongnu.org > Subject: Re: [avr-libc-dev] Re: Request for cbrt() and strdup > to be addedtolibc > > As Weddington, Eri

Re: [avr-libc-dev] Re: Request for cbrt() and strdup to be added tolibc

2008-06-22 Thread Joerg Wunsch
As Weddington, Eric wrote: > Good catch. Regardless whether it generates the same code or not, it > should be compared to NULL anyway because one should never rely on > NULL being zero. In C, the only possible definitions for NULL are "0" or "((void *)0)". In C++, IIRC only "0" is possible. > Si

RE: [avr-libc-dev] Re: Request for cbrt() and strdup to be added tolibc

2008-06-22 Thread Weddington, Eric
> -Original Message- > From: > [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > org] On Behalf Of Joerg Wunsch > Sent: Sunday, June 22, 2008 2:09 PM > To: avr-libc-dev@nongnu.org > Subject: Re: [avr-libc-dev] Re: Request for cbrt() and strdup > to be added tolibc > > As Andy H wrote:

Re: [avr-libc-dev] Re: Request for cbrt() and strdup to be added to libc

2008-06-22 Thread Joerg Wunsch
As Joerg Wunsch wrote: > >memcpy(copy, str, len); > > Better copy len+1 so the trailing \0 will be copied as well. Drop that, it's nonsense, sorry. ;-) (I overlooked the +1 earlier.) -- cheers, J"org .-.-. --... ...-- -.. . DL8DTL http://www.sax.de/~joerg/

Re: [avr-libc-dev] Re: Request for cbrt() and strdup to be added to libc

2008-06-22 Thread Joerg Wunsch
As Andy H wrote: > double cbrt(const double x) > > { > return pow(x,1.0/3.0); > } If cbrt() is going to be more than just an alibi function to make GCC tests happy, then it should probably be implemented similar to the existing libm functions. > char * strdup( const char *str) > { >uns

[avr-libc-dev] Re: Request for cbrt() and strdup to be added to libc

2008-06-22 Thread Andy H
Here are some generic version that can be used as starter. I'm sure someone can trim them up a bit - or even convert to asm. Best version depends on how we built existing maths functions. double cbrt(const double x) { return pow(x,1.0/3.0); } double cbrt(const double xx) { double x= xx;

[avr-libc-dev] RE: Request for cbrt() and strdup to be added to libc

2008-06-22 Thread Weddington, Eric
I don't see any problem with adding these to avr-libc, other than a lack of an implementation. ;-) In general, we try to do as much hand-coded assembly as possible, except for very large functions (e.g. printf and friends) where it would be difficult to do so. Eric > -Original Message-