473,378 Members | 1,426 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

how to remove warning: initialization from incompatible pointer type?

I compiles a program in SLOS, but there is a warning i donot know how
to remove?

here is the framework of the code:
typedef struct device_tree
{
......

union
{
INT8U (*byte)(UID id); //read a byte from a particular device
INT8U (*bit)(UID id); //read a bit from a particular device
INT8U (*block)(UID id, block_data_t *block_w); //read a block
from a particular device
INT8U (*blockext)(UID id, block_data_t *block_w, unsigned long
addr, unsigned long length);
// read a block from flash or cf card
} read;
} device_tree_t;

device_tree_t devices[] =
{
{
/* device driver for serial ports */
"SERIO",
DEVICE_SERIO,
serio_init,
serio_open,
serio_close,
{outbyte},
{inbyte}, //*************this is warning line
*************************
isdataready,
0
},

{
"\0",
0,
0,
0,
0,
{0},
{0},
0,
0
}
};

INT8U inbyte(UID id, block_data_t *block_w)
{
//do something
}

Jul 26 '06 #1
2 9686
wa*********@gmail.com wrote:
I compiles a program in SLOS, but there is a warning i donot know how
to remove?
You don't have to post three times!
here is the framework of the code:
typedef struct device_tree
{
......

union
{
INT8U (*byte)(UID id); //read a byte from a particular device
INT8U (*bit)(UID id); //read a bit from a particular device
INT8U (*block)(UID id, block_data_t *block_w); //read a block
from a particular device
INT8U (*blockext)(UID id, block_data_t *block_w, unsigned long
addr, unsigned long length);
// read a block from flash or cf card
} read;
} device_tree_t;

device_tree_t devices[] =
{
{
/* device driver for serial ports */
"SERIO",
DEVICE_SERIO,
serio_init,
serio_open,
serio_close,
{outbyte},
{inbyte}, //*************this is warning line
*************************
Where is inbyte declared?
isdataready,
INT8U inbyte(UID id, block_data_t *block_w)
{
//do something
}
This signature doesn't match the first item in the enum (the only one
you can initialise).

--
Ian Collins.
Jul 26 '06 #2
Ian Collins wrote:
wa*********@gmail.com wrote:
>>INT8U inbyte(UID id, block_data_t *block_w)
{
//do something
}

This signature doesn't match the first item in the enum (the only one
you can initialise).
Oops, that should read 'union' not enum.

--
Ian Collins.
Jul 26 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: isxyos | last post by:
Hello, It's just a warning, but can anybody explain to me what this warning is: warning C4047: '=' : 'unsigned int ' differs in levels of indirection from 'void *' #include <stdio.h> void...
29
by: junky_fellow | last post by:
Consider the following piece of code: struct junk { int i_val; int i_val1; char c_val; }; int main(void) {
6
by: PraZ | last post by:
Hi all. Here is a simple code, which when compiled with gcc results in the warning "incompatible pointer type" for arg 1, as expected. But this is just what I want to do, because it makes it...
8
by: Michael | last post by:
Hi all, why do I get a message: warning: passing arg 1 of `collectInput' from incompatible pointer type In 'main' have: char inputString; collectInput(&inputString);
17
by: I.M. !Knuth | last post by:
Hi. I'm more-or-less a C newbie. I thought I had pointers under control until I started goofing around with this: ...
1
by: wanglei0214 | last post by:
I compiles a program in SLOS, but there is a warning i donot know how to remove? here is the framework of the code: typedef struct device_tree { ...... union {
92
by: Heinrich Pumpernickel | last post by:
what does this warning mean ? #include <stdio.h> int main() { long l = 100; printf("l is %li\n", l * 10L);
4
by: lovecreatesbea... | last post by:
Gcc only gives out a warning: `assignment discards qualifiers from pointer target type' against code such as following: $ type a.c int main(void) { const char *pc; char *p = pc;
10
by: MisterE | last post by:
typedef struct sg { int a; } G; int c(G* g) { return g->a; }
4
by: Andre | last post by:
Hi All, When I compile the following piece of code with gcc, I get 3 "warning: initialization discards qualifiers from pointer target type" messages which refer to the 3 lines marked in the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.