MisterE said:
oops, err that should be int main(int argc, char **argv)
Before "MisterE" just left the question out of the body of the text. This
time he has destroyed any context at all, making the above
incomprehensible.
[Restored question and context]
Subject: Should a compiler produce a warning/error for this?
typedef struct sg
{
int a;
} G;
int c(G* g)
{
return g->a;
}
int main /* was: void */(int argc, char **argv)
{
G g;
c(g); //<----- instead of c(&g);
}
[Answer]
Of course the compiler should issue a diagnostic when the type of the
argument is incompatible with the type of the parameter.
If it doesn't, I suspect you have almost all diagnostics turned off.
Turn them on! Now!