Mail Archives: djgpp/2000/10/17/10:30:13
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 -