[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Not an xwpe question.



At 01:40 PM 5/30/00 -0600, Roy Souther wrote:
>I am having a problem with, I think, my compiler and I just wanted to know if

Nope, I believe you actually are using printf incorrectly.

[SNIP]
>anyone eles is having a similar problem. I am using egcs 2.91.66 on Red 
>Hat 6.1.
>My problme is unsigned ints and unsigned longs, they are singend. I have been
>having problems with my software and wrote this code to find that problem.
>
>
>#include <stdio.h>
>
>void main(void)

This should be int main (void), but it doesn't really matter.  Some 
compilers will complain about this.  This of course has nothing to do with 
your problem, but as a former CS I instructor, I have to point it out.  :)

>         printf("sizeof(MyUInt)=%d\n",sizeof(MyUInt));           // Shows 
> 4, good
>         MyUInt=0;
>         MyUInt--;

MyUInt has the value you want it to have.

>         printf("MyUInt=%d\n\n",MyUInt); 
 >               // Shows -1, wrong!