const and struct pointers
Walter Murray
walter at hpclwjm.HP.COM
Tue Feb 27 05:17:33 AEST 1990
Robert Adsett:
> #include <math.h>
> struct qwert { int a; double b;};
> void asdf( struct qwert a);
> const double a = 3.0;
> void junk( const double *b, const struct qwert *c)
> {
> (void)exp(a); /* Works */
> (void)exp(*b); /* Works */
> asdf( *c); /* Type mismatch ???? */
> }
> The compiler gives a type mismatch in argument error for the line
> indicated.
Doug Gwyn:
> The compiler was correct to complain about an argument that had as its
> type "pointer to qualified type" being passed to a function expecting
> a pointer to an unqualified type.
But in the posted example, the argument and parameter are structures,
not pointers. It seems to me that the code is legal.
Walter Murray
----------
More information about the Comp.std.c
mailing list