Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/stdlib.cfa

    rf8729be rb5e725a  
    1010// Created On       : Thu Jan 28 17:10:29 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 16 16:31:34 2023
    13 // Update Count     : 633
     12// Last Modified On : Mon Aug 14 18:22:36 2023
     13// Update Count     : 642
    1414//
    1515
     
    6565//---------------------------------------
    6666
    67 float _Complex strto( const char sptr[], char ** eptr ) {
     67forall( T | { T strto( const char sptr[], char * eptr[], int ); } )
     68T convert( const char sptr[] ) {
     69        char * eptr;
     70        errno = 0;                                                                                      // reset
     71        T val = strto( sptr, &eptr, 10 );                                       // attempt conversion
     72        if ( errno == ERANGE ) throw ExceptionInst( out_of_range );
     73        if ( eptr == sptr ||                                                            // conversion failed, no characters generated
     74                 *eptr != '\0' ) throw ExceptionInst( invalid_argument ); // not at end of str ?
     75        return val;
     76} // convert
     77
     78float _Complex strto( const char sptr[], char * eptr[] ) {
    6879        float re, im;
    6980        char * eeptr;
     
    7687} // strto
    7788
    78 double _Complex strto( const char sptr[], char ** eptr ) {
     89double _Complex strto( const char sptr[], char * eptr[] ) {
    7990        double re, im;
    8091        char * eeptr;
     
    8798} // strto
    8899
    89 long double _Complex strto( const char sptr[], char ** eptr ) {
     100long double _Complex strto( const char sptr[], char * eptr[] ) {
    90101        long double re, im;
    91102        char * eeptr;
Note: See TracChangeset for help on using the changeset viewer.