Daniel Stenberg <daniel_at_haxx.se> writes:
> On Mon, 1 Mar 2010, Simon Josefsson wrote:
>
>>> Ah, yes it was a warning only, the error must've been some mistake
>>> of mine. I like -Wundef because it makes you write stricter code
>>> that leaves less mistakes around. Like when you do #if [misspelled
>>> define] which always will evaluate false but with -Wundef will give
>>> you a clear warning. That specific mistake is also very hard to
>>> spot and track down (and yes I've seen it happen more than once).
>>
>> I understand, and I've seen that too. There are disadvantages
>> though: if someone declares the constant to 0 and expects the
>> feature to be disabled. Further, it encourages adding defined-checks
>> to all CPP symbols regardless of how they are intended to be used.
>> I've seen these two patterns cause problems more than once as well.
>
> Yes, as a consequence of the above I think enabling and disabling
> features in code should be done with #ifdef and #define/#undef, and
> not #if and #define [variable] 0/1.
Consistency is good; there is plenty of legacy code in crypt.c,
openssl.c, mac.c etc that we could clean up. Right now the code seems
to use a mix of these two patterns, which IMHO is worse then picking any
of them and sticking to it.
Yes, I am probably responsible for some of this, but hopefully not all
of it. ;-)
To little time to fix this right now though.
/Simon
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-03-01