Ignore:
Timestamp:
Feb 10, 2016, 3:57:00 PM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
6ba0659, cce7872
Parents:
bd85400
Message:

syslib updates and examples, formatting, make double 0 work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/stdlib.c

    rbd85400 r52f85e0  
    1010// Created On       : Thu Jan 28 17:10:29 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Feb  5 15:41:24 2016
    13 // Update Count     : 128
     12// Last Modified On : Wed Feb 10 15:45:56 2016
     13// Update Count     : 140
    1414//
    1515
     
    2323#include <string.h>                                                                             // memset
    2424#include <malloc.h>                                                                             // malloc_usable_size
    25 #include <stdio.h>
    2625#include <math.h>                                                                               // fabsf, fabs, fabsl
    2726#include <complex.h>                                                                    // _Complex_I, cabsf, cabs, cabsl
     
    106105long int ato( const char * ptr ) {
    107106        long int li;
    108         if ( sscanf( ptr, "%ld", &li ) == EOF ) {};                     // check return code
     107        if ( sscanf( ptr, "%ld", &li ) == EOF ) {}                      // check return code
    109108        return li;
    110109}
    111110unsigned long int ato( const char * ptr ) {
    112111        unsigned long int uli;
    113         if ( sscanf( ptr, "%lu", &uli ) == EOF ) {};            // check return code
     112        if ( sscanf( ptr, "%lu", &uli ) == EOF ) {}                     // check return code
    114113        return uli;
    115114}
    116115long long int ato( const char * ptr ) {
    117116        long long int lli;
    118         if ( sscanf( ptr, "%lld", &lli ) == EOF ) {};           // check return code
     117        if ( sscanf( ptr, "%lld", &lli ) == EOF ) {}            // check return code
    119118        return lli;
    120119}
    121120unsigned long long int ato( const char * ptr ) {
    122121        unsigned long long int ulli;
    123         if ( sscanf( ptr, "%llu", &ulli ) == EOF ) {};          // check return code
     122        if ( sscanf( ptr, "%llu", &ulli ) == EOF ) {}           // check return code
    124123        return ulli;
    125124}
    126125float ato( const char * ptr ) {
    127126        float f;
    128         if ( sscanf( ptr, "%f", &f ) == EOF ) {};                       // check return code
     127        if ( sscanf( ptr, "%f", &f ) == EOF ) {}                        // check return code
    129128        return f;
    130129}
    131130double ato( const char * ptr ) {
    132131        double d;
    133         if ( sscanf( ptr, "%lf", &d ) == EOF ) {};                      // check return code
     132        if ( sscanf( ptr, "%lf", &d ) == EOF ) {}                       // check return code
    134133        return d;
    135134}
    136135long double ato( const char * ptr ) {
    137136        long double ld;
    138         printf( "FRED " );
    139         if ( sscanf( ptr, "%.32Lf", &ld ) == EOF ) {};          // check return code
     137        if ( sscanf( ptr, "%Lf", &ld ) == EOF ) {}                      // check return code
    140138        return ld;
    141139}
    142140float _Complex ato( const char * ptr ) {
    143141        float re, im;
    144         if ( sscanf( ptr, "%g%g", &re, &im ) == EOF ) {};       // check return code
     142        if ( sscanf( ptr, "%g%gi", &re, &im ) == EOF ) {}       // check return code
    145143        return re + im * _Complex_I;
    146144}
    147145double _Complex ato( const char * ptr ) {
    148146        double re, im;
    149         if ( sscanf( ptr, "%.16lg%.16lg", &re, &im ) == EOF ) {}; // check return code
     147        if ( sscanf( ptr, "%lf%lfi", &re, &im ) == EOF ) {} // check return code
    150148        return re + im * _Complex_I;
    151149}
    152150long double _Complex ato( const char * ptr ) {
    153151        long double re, im;
    154         if ( sscanf( ptr, "%.32Lg%.32Lg", &re, &im ) == EOF ) {}; // check return code
     152        if ( sscanf( ptr, "%Lf%Lfi", &re, &im ) == EOF ) {}     // check return code
    155153        return re + im * _Complex_I;
    156154}       
Note: See TracChangeset for help on using the changeset viewer.