On 08/25/2011 04:52 PM, Kevin Wolf wrote:
>
> It's not pretty, but it lets us preserve compatibility. I think it's
> also safer for dealing with pointers because otherwise you have a mix of
> pointers that may be null and may not be null. Having a clear
> indication of which pointers are nullable makes for safer code.
I'm not saying that implementing a default value in generic (or
generated) code works for all cases. But if the schema supported default
values, we could get rid of the parameter in all simple cases (which I
would expect to be the majority); and if there is no default value in
the schema, we could still generate the has_* parameters.
An alternative is to pass a struct by value, with a .valid bool followed
by the actual value (which should be initialized even if not valid, just
to be safe).
--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.