avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] strtoul() bug?


From: Geoffrey Wossum
Subject: Re: [avr-libc-dev] strtoul() bug?
Date: Mon, 9 Jun 2003 13:24:03 -0500
User-agent: KMail/1.5

On Monday 09 June 2003 12:54 pm, Lou Cyphre wrote:
> I'm compiling for an ATMEGA128, and it seems I never succeed with
> strtoul() working: always getting back 0xFFFFFFFFul
> I'm calling it as
>    n = strtoul( s, NULL, 0 );
> or
>    n = strtoul( s, NULL, 10 );
> and 's' points to a string in data memory, '\0' terminated (see below).

Non-rambling version:  
Yes, avr-libc seems to have a problem.  Make your own strtoul() function to 
work around avr-libc's problem.

Rambling version:
Yes, this is a real problem.  I have an xstrtoul() function in my library that 
I use instead.  It's basically just strtoul() from the FreeBSD libc.  The 
problem is due to the ctype family of functions (isascii(), isalpha(), 
isdigit(), isupper(), and friends) not working properly working when they are 
invoked from inside avr-libc's strtoul().  With older avr-gcc toolchains, 
there was also a problem if you used ctype functions in a function which was 
part of a library (.a file).  This problem disappeared a while back.  Back 
when this problem still existed, I had to have every project have their own 
xstrtoul.c file directly linked into it.  Now I can just use xstrtoul() from 
my standard library.  strtoul() still doesn't seem to work.  I never could 
figure out why the ctype functions acted weird, though.

---
Geoffrey Wossum
Software Engineer
Long Range Systems - http://www.pager.net






reply via email to

[Prev in Thread] Current Thread [Next in Thread]