const and struct pointers

Doug Gwyn gwyn at smoke.BRL.MIL
Wed Feb 28 06:09:54 AEST 1990


In article <12570046 at hpclwjm.HP.COM> walter at hpclwjm.HP.COM (Walter Murray) writes:
>But in the posted example, the argument and parameter are structures,
>not pointers.  It seems to me that the code is legal.

Thanks for posting the original example, which I had misremembered
as passing a pointer, not the actual struct.  Of course you're right
that a qualified struct can be passed to a function expecting an
unqualified struct, because the argument is assignment-compatible
(meaning: 3.3.16.1 Constraints are met) with the parameter type,
once the qualifier is stripped as per 3.2.2.1, as footnote 48 in the
December 1988 draft reminds us.  It's easy to see how an implementor
could miss that, by not taking literally the requirement that
argument passing be as if by simple assignment.



More information about the Comp.std.c mailing list