File tree 2 files changed +6
-7
lines changed
2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change 4
4
What should stdlib contain, and current status.
5
5
6
6
atof - ok, inlined, bound to sscanf
7
- atoi - ok, inlined, bound to sscanf, will read hex and octal
8
- atol - ok, inlined, bound to sscanf, will read hex and octal
7
+ atoi - ok, inlined, bound to strtol
8
+ atol - ok, inlined, bound to strtol
9
9
strtod - missing
10
10
strtof - missing
11
11
strtold - missing (do we want to support long double anyway?)
Original file line number Diff line number Diff line change @@ -21,11 +21,10 @@ int rand_r(unsigned int * seed);
21
21
static __inline__ int rand (void ) { return rand_r (& _seed ); }
22
22
static __inline__ void srand (unsigned int seed ) { _seed = seed * 3835238167UL ; }
23
23
24
- static __inline__ double atof (const char * str ) { double r = 0 ; sscanf (str , "%lf" , & r ); return r ; }
25
- static __inline__ int atoi (const char * str ) { int i ; sscanf (str , "%i" , & i ); return i ; }
26
- static __inline__ int atol (const char * str ) { long l ; sscanf (str , "%li" , & l ); return l ; }
27
-
28
24
long int strtol (const char * nptr , char * * endptr , int base );
29
25
30
- END_DECL
26
+ static __inline__ double atof (const char * str ) { double r = 0 ; sscanf (str , "%lf" , & r ); return r ; }
27
+ static __inline__ int atoi (const char * str ) { return strtol (str , NULL , 10 ); }
28
+ static __inline__ long atol (const char * str ) { return strtol (str , NULL , 10 ); }
31
29
30
+ END_DECL
You can’t perform that action at this time.
0 commit comments