Mail Archives: djgpp/2005/02/25/07:01:12
Sterten AT aol DOT com wrote:
> [-- text/plain, encoding 7bit, charset: US-ASCII, 18 lines --]
> >DJGPP already supports 64-bit variables: there's the `long long' data
> >type which is 64-bit wide.
>
> very good ! Thanks. I didn't know that. Probably because it's different
> in other compilers so when someone sends me a program which uses 64-bit
> then I can't compile it.
>
> #define int long long
*Never* do that. You're practically begging for the sky to crash down
on your head by redefining a fundamental C datatype name that way.
> //#define %i %Li , this doesn't work
Of course it doesn't. And guess what: that's a good thing.
long long i,j;
int main(){
^^^
That one's mandatory, these days.
> i=13267364410352;
Constants larger than int have to be flagged as such, to be reliable. Make
that
i = 13267364410352LL;
> m1:printf("short:%i long:%Li\n",i,i); //this doesn't work. Why ?
Because you're not trying treat *the same* variable, i, as both an int
and as a long long. That cannot possibly work.
> printf("short:%i ",i);printf("long:%Li\n",i); //this works
If it does, that's by pure luck. It's dangerously wrong.
> if(i%2==0){i=i/2;goto m1;}
> }
Your program is missing a 'return' statement.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -