www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/10/17/10:30:13

Message-ID: <39EC61A9.44C54582@email.com>
Date: Tue, 17 Oct 2000 22:26:50 +0800
From: Derek Chew <sdchew AT email DOT com>
X-Mailer: Mozilla 4.75 [en] (Windows NT 5.0; U)
X-Accept-Language: en,ja,zh,zh-CN,zh-TW
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Unsigned Int Problem
References: <39EC53CC DOT EAA6B85E AT email DOT com> <8shkg5$75r$1 AT pegasus DOT csx DOT cam DOT ac DOT uk>
Lines: 37
NNTP-Posting-Host: 203.59.74.214
X-Trace: news.iinet.net.au 971792776 624 Nn5swf AT 203 DOT 59 DOT 74 DOT 214
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

cool.. thanks man...

and may I ask what scanf format string do I use for this one? %u gives a
warning...

Murray Rogers wrote:

> Unsigned short int should do the job.
>
> Derek Chew <sdchew AT email DOT com> wrote in message
> news:39EC53CC DOT EAA6B85E AT email DOT com...
> > Hi there everyone.. I just recently shifted from using Borland Turbo C++
> > to DJGPP and I besides the funny error messages that GCC gives, its been
> > quite a good experience...
> >
> > most recently, I noticed that one of my old functions that I wrote using
> > TC has been acting wierdly.. I did some further investigate a bit futher
> > and found that this line of code executes differently in TC and GCC
> >
> > main()
> > {
> >  unsigned int data=1;
> >  data=0-data;
> >  printf("%u",data);
> >  return;
> > }
> >
> > on TC, I will get the desire result of 65535 as the 16-bit unsigned int
> > will overflow into and display this value... but apparently, under
> > DJGPP/GCC, an unsigned int is 32-bit and I get the unwanted value of
> > 4294967295 ...
> >
> > is there a good work around to allow the code to work in both compilers?
> >
> > thanks a lot guys!
> >

- Raw text -


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