Weird gcc behaviour with function pointer types
- From: greg <greg@xxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 30 Mar 2007 01:05:12 +1200
In my quest to eliminate C compiler warnings from
Pyrex output, I've discovered some utterly bizarre
behaviour from gcc 3.3.
The following code:
void g(struct foo *x) {
}
void f(void) {
void (*h)(struct foo *);
h = g;
}
produces the following warning:
blarg.c: In function `f':
blarg.c:6: warning: assignment from incompatible pointer type
However, adding the following line at the top:
typedef struct foo Foo;
makes the warning go away. The mere *presence* of
the typedef is all that's needed -- it doesn't even
have to be used.
This looks like a bug in gcc to me -- what do people
think?
--
Greg
.
- Follow-Ups:
- Re: Weird gcc behaviour with function pointer types
- From: Roger Miller
- Re: Weird gcc behaviour with function pointer types
- From: attn . steven . kuo
- Re: Weird gcc behaviour with function pointer types
- Prev by Date: Re: Modal value of an array
- Next by Date: Re: YouTube showing repr() of a tuple
- Previous by thread: Weird behavior in search in a list
- Next by thread: Re: Weird gcc behaviour with function pointer types
- Index(es):
Relevant Pages
|
|