const religion

derrell at samba.org derrell at samba.org
Thu Mar 31 00:26:44 GMT 2005


Andrew Bartlett <abartlet at samba.org> writes:

> Samba4 uses discard_const_p() to have *zero* const warnings, no matter the
> compile flags.
> ...
> const and formal correctness is a hot-button issue for some - I simply
> see it simply as an extra tool to be used as far as reality allows, to
> try and catch silly bugs.

Sounds great to me.  I'd just like to see the code compile cleanly so if any
warnings ever do show up, they're taken seriously.

I've looked at discard_const_p() in samba4.  It appears to just cast to void*
and then to the appropriate type.  I take it you use this only when there's a
const warning due to function parameter definitions beyond your control?  That
same mechanism could be used in samba3.  I'll spend another couple hours on
this before deciding it's hopeless. :-)  I'll see if I can add the samba4
mechanism cleanly to samba3 and eliminate the warnings even with the full set
of flags set by --enable-developer.

Derrell

ps I feel I'm being a PITA about this stuff, but really, my goal is to help
provide a coding environment that is more conducive to writing bug-free code.
If I'm going off the deep end, or recalling religious wars of years past, feel
free to tell me to shut up, and I will.


More information about the samba-technical mailing list