Subject: Re: FW: Missing strtoull()...: long long standard
From: [email-masked] (root)

19 Jul 1998 04:16:35 -0700
Message-ID: <[email-masked]>
References: <[email-masked]>
Content-Type: text
To: [email-masked] (Brendan Simon)
Cc: [email-masked]

> 
> My guess is that long long & unsigned long long are not part of the ANSI C
> standard.  GCC is the only compiler I've seen that supports that syntax so
> I assume its a GCC extension to the C language to get 64 bits.
> It would be nice to get a standard 64 bit type.  Does any one know if this
> exists or if one has been proposed ?
> 
> Brendan Simon.
> 
> 

Yes, a standard exists, albeit it is not the official standard yet.
The ANSI C next standard is being discussed as the document:
 WG14/NT794 j11/97-158.

This document proposes long long as a type for the C language page 38.
lcc-win32 has implemented this type too as a long long, with an (automatic)
#define  __int64 long long
to remain Microsoft compatible.

As to strtoll, my system uses atoll, what should be equivalent...
It is not that complicated actually...

Here it is:
----------------------------------------------------- strtoll.c-----------
long long _strtoll(char *str)
{
        long long result = 0;
        int negative=0;

        while (*str == ' ' || *str == '\t')
                str++;
        if (*str == '+')
                str++;
        else if (*str == '-') {
                negative = 1;
                str++;
        }

        while (*str >= '0' && *str <= '9') {
                result = (result*10)+(*str++ - '0');
        }
        return negative ? -result : result;
}

-----------------------------------------------------end of strtoll.c

Unsigned versions are not that complicated either. I leave that as an exercise
to the reader :-)

-- 
Jacob Navia	Logiciels/Informatique
41 rue Maurice Ravel			Tel 01 48.23.51.44
93430 Villetaneuse 			Fax 01 48.23.95.39
France
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".