I have two typedefs for function pointers and two structs, struct pipe_s and struct pipe_buffer_s defined as so:
typedef void (*pipe_inf_t)(struct pipe_buffer_s *);
typedef void (*pipe_outf_t)(struct pipe_buffer_s *);
struct
pipe_buffer_s
{
size_t cnt; /* number of chars in buffer */
size_t len; /* length of buffer */
uint8_t *mem; /* buffer */
};
struct
pipe_s
{
struct pipe_buffer_s buf;
uint8_t state;
pipe_inf_t in; /* input call */
pipe_outf_t out; /* output call */
};
In my implementation, I have a function that attempts to call the function in:
void
pipe_receive(struct pipe_s *pipe)
{
pipe_inf_t in;
in = pipe->in;
in(&pipe->buf);
}
But I am getting the strange error:
pipe.c:107:5: note: expected 'struct pipe_buffer_s *' but argument is of type 'struct pipe_buffer_s *'
This makes no sense to me. As far as I can tell, I haven't goofed up and tried to use a struct of undefined length because I'm only using pointers here. I think I may have done something wrong with my typedef...
Changing the typedef to typedef void (*pipe_inf_t)(int); and calling in(5) works just fine however.
I get the same error if I move in and out into the pipe_buffer_s struct and call them from there so location doesn't seem to matter.
Any ideas?
gccwithstd=c89.struct pipe_buffer_sas the typedefs need that struct definition.