This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Qwery regarding the While() in gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)


Hai pal,

I am using gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5). I have got a code which is not
working according to what i expect. Can u tell me the reason behind that or is that a bug in the
gcc version, i dont have another complier, i executed it with its "g++ " clone also. That too gave
me the same results,

-----------------------------------------

int main(){
        unsigned short i = 3;
        while(i > -1)
                printf("%u\n",i--);
        return 0;
}

output: 3,2,1,0,65535,...............
------------------------------------------- 

int main(){
        unsigned int i = 3;
        while(i > -1)
                printf("%u\n",i--);
         return 0;
}

output: "Nothing"
--------------------------------------------

One using integer, the compiler is not producing even the assembly code for the while part.

The only difference is that in the first the 'i' is 'short' and in the second it is 'int'.

please take a look to help me........

thanks..

=====
Riyashmon H

Software Engineer,
Qcomp Systems & Softwares
#2 1st Floor, Vivek Complex,
SM Road, Jalahalli West,
Bangalore - 560015

Ph: 28399948
Email: riyash@qcomp.cc

________________________________________________________________________
Yahoo! India Insurance Special: Be informed on the best policies, services, tools and more. 
Go to: http://in.insurance.yahoo.com/licspecial/index.html


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]