jdf@UUNET.UU.NET (Jean-Daniel FEKETE) (11/21/88)
The following code outputs a warning in gcc 1.30 :
gcc -O -W -S foo.c
----------------------------------------------------------------------
typedef int func_typed(struct _object *);
struct _object {
func_typed *fn;
};
typedef struct _object object;
object o;
int doit_on(obj)
object *obj;
{
int b;
b = (* o.fn)(obj);
/* it says : warning: argument passing between incompatible pointer types */
bar(b); /* this is to avoid optimization maybe */
return b;
}
----------------------------------------------------------------------
whereas the following does not:
----------------------------------------------------------------------
struct _object {
int (* fn)(struct _object *);
};
typedef struct _object object;
object o;
int doit_on(obj)
object *obj;
{
int b;
b = (* o.fn)(obj);
bar(b); /* this is to avoid optimization maybe */
return b;
}
----------------------------------------------------------------------
strange isn't it ?
Jean-Daniel.