ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2005/02/25/07:01:12

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: long long
Date: 25 Feb 2005 11:50:07 GMT
Lines: 52
Message-ID: <388hnfF5li8i5U1@news.dfncis.de>
References: <140 DOT 3ef15c87 DOT 2f500941 AT aol DOT com>
X-Trace: news.dfncis.de aCDffuay2AUMjNDLATphowavqqMydLH4x/Az3F/GFPvGVW6qSONlYq+DHF
X-Orig-Path: not-for-mail
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019