Rules | Recent posts | topic RSS | Search | Register  | Log in

how to use 'long long int' or 'unsigned long int' in C prog

 
Post new topic  Reply to topic    EDAboard.com Forum Index -> PC Programming and Interfacing
Author Message
rizalafande



Joined: 04 Jan 2006
Posts: 11


Post22 Aug 2008 10:47   how to use 'long long int' or 'unsigned long int' in C prog

hi,
i got the problems to use the 'long long int' and 'unsigned long int' data types in C programming (becasue i would like to use 64bit and unsigned 32bit data in my design). when i run the simulation using Linux compiler (gcc), it is always give me an error "warning: this decimal constant is unsigned only in ISO C90". example of my codes are written below.
===================
long long int newValue (long long int a)
{
unsigned long int res;

a = 2147483700;
res = a*1;

}
====================
can anyone helps me out. thanks.
Back to top
jhbbunch



Joined: 21 Feb 2006
Posts: 220
Helped: 15


Post23 Aug 2008 18:20   how to use 'long long int' or 'unsigned long int' in C prog

First, you have a return of long long int, buy there is no return of anything in the fucntion. Second whis is res an unsigned long int and a is a long long int? The compiler is warning you that this is valid only in the iso c90 standard. I assume other standards will treat one as signed and the other as unsigned.

And it appears that unsigned long int is a 32 bit value (check this) and long long int is definitely a 64 bit integer. Just change res to long long int.
Back to top
Post new topic  Reply to topic    EDAboard.com Forum Index -> PC Programming and Interfacing
Page 1 of 1 All times are GMT + 1 Hour


Abuse
Administrator
Moderators
topic RSS 
sitemap