LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-18-2011, 06:22 AM   #1
sajnanazeer
LQ Newbie
 
Registered: Dec 2010
Posts: 14

Rep: Reputation: 0
error: large integer implicitly truncated to unsigned type


Hi,

My program is doing an i2c page read operation. The function declaration is:
Quote:
int PageRead( uint8_t address, uint8_t reg, uint8_t length, uint8_t* pBuffer );
I am calling this function from my main like this:
Quote:
uint8_t length = 10;
uint8_t buf[2][20];
uint8_t addr = 0x50;
uint8_t reg = 0x00;

ret = PageRead( addr, reg, length, buf[0]);
I am trying to compile my program and getting error from the line calling PageRead:

Quote:
error: large integer implicitly truncated to unsigned type
I am compiling with options -c -fPIC -g -O2 -m64 -Werror -Wcomments -Wreturn-type -Wsign-compare -Wall .

Can anyone help me to fix this?

Thanks in advance,
Sajna
 
Old 08-18-2011, 07:16 AM   #2
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 448Reputation: 448Reputation: 448Reputation: 448Reputation: 448
Hi

What is the type of "ret"? If it's not int, that would explain it.
 
Old 08-18-2011, 10:53 AM   #3
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by sajnanazeer View Post
Hi,

My program is doing an i2c page read operation. The function declaration is:


I am calling this function from my main like this:


I am trying to compile my program and getting error from the line calling PageRead:



I am compiling with options -c -fPIC -g -O2 -m64 -Werror -Wcomments -Wreturn-type -Wsign-compare -Wall .

Can anyone help me to fix this?

Thanks in advance,
Sajna
How about publishing full source code ?
 
Old 08-18-2011, 11:16 PM   #4
sajnanazeer
LQ Newbie
 
Registered: Dec 2010
Posts: 14

Original Poster
Rep: Reputation: 0
Hi... Thanks for your response.

ret is an int variable. It is used for checking return status.

-
Sajna
 
Old 08-19-2011, 02:32 AM   #5
sajnanazeer
LQ Newbie
 
Registered: Dec 2010
Posts: 14

Original Poster
Rep: Reputation: 0
I did find my mistake.. One of my argument to the function was not uint8_t. It was a #define macro. That's why I am getting that error.

Thanks for all replies...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
c unsigned type tanoatlq Programming 11 11-28-2009 03:01 PM
cifs and 426 Sendfile error: Value too large for defined data type punt Linux - Networking 5 04-10-2008 05:59 AM
converting char to unsigned integer in c mohtasham1983 Programming 2 02-27-2007 02:58 PM
Length of an unsigned integer Deepak Inbasekaran Programming 8 06-07-2006 11:47 PM
Integer Constant is too large B00H Linux - Software 7 11-01-2005 09:39 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration