On Thu, Mar 3, 2011 at 10:47 AM, Julian Foad <julian.foad_at_wandisco.com> wrote:
> On Thu, 2011-03-03 at 16:33 +0000, Philip Martin wrote:
>> Greg Stein <gstein_at_gmail.com> writes:
>> > On Thu, Mar 3, 2011 at 10:35, Hyrum K Wright <hyrum_at_hyrumwright.org> wrote:
>> >> On Thu, Mar 3, 2011 at 9:03 AM, <philip_at_apache.org> wrote:
>> >>> Author: philip
>> >>> Date: Thu Mar 3 15:03:42 2011
>> >>> New Revision: 1076645
>> >>> URL: http://svn.apache.org/viewvc?rev=1076645&view=rev
>> >>> Log:
>> >>> Wrap pointer in a baton to avoid a complier warning or cast.
>> >> I think a single cast is better than the obfuscation of wrapping a
>> >> single value in a baton. Please reconsider this change.
>> > Agreed. I'd much rather see (void *)changelist, than all of this stuff.
>> A cast that changes the type, (void *)changelist, or one that just
>> removes the qualifier, (char *)changelist? Casts lead to questions.
> Sure a single arg in a struct is a bit ugly. But I don't like casting
> away "const" when we don't need to, as it can be a very useful warning
> if we don't have too many false alarms.
> Either way is ugly. C language has these holes in it - in this case,
> passing a pointer that may or may not be "const" just isn't well
> supported - so we have to do something ugly to work around it. There's
> no clear winner here.
> It's hardly obfuscation to pass a structure as a baton: that is the
> *normal* pattern for passing args to such a function. Passing a casted
> pointer to a singleton argument is the special case.
Sure, but it just makes the code more complex. If I were to have a
const struct as a baton, would we also wrap that in a separate
single-member struct, just to avoid casting away the const? I hope
not. And give that argument, it makes little sense to do so in this
Received on 2011-03-03 18:42:24 CET