Message-ID: <39EC53CC.EAA6B85E@email.com> Date: Tue, 17 Oct 2000 21:27:40 +0800 From: Derek Chew 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: Unsigned Int Problem Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 25 NNTP-Posting-Host: 203.59.74.214 X-Trace: news.iinet.net.au 971789228 640 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 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!