Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > how to remove warning: initialization from incompatible pointer type?

Reply
Thread Tools

how to remove warning: initialization from incompatible pointer type?

 
 
wanglei0214@gmail.com
Guest
Posts: n/a
 
      07-26-2006
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
}

 
Reply With Quote
 
 
 
 
Ian Collins
Guest
Posts: n/a
 
      07-26-2006
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.
 
Reply With Quote
 
 
 
 
Ian Collins
Guest
Posts: n/a
 
      07-26-2006
Ian Collins wrote:
> 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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Proper Initialization of Pointer to Pointer bwaichu@yahoo.com C Programming 11 02-09-2008 05:33 PM
how to remove warning: initialization from incompatible pointer type? wanglei0214@gmail.com C Programming 1 07-26-2006 04:56 PM
how to remove warning: initialization from incompatible pointer type? wanglei0214@gmail.com C Programming 0 07-26-2006 07:51 AM
initialization from incompatible pointer type Brian Stubblefield C Programming 3 05-27-2004 01:31 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57