[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: commit: ldap/include lber_pvt.h



Howard Chu writes:
>(...)
>>> Silence BER_BVC warning
>>> -#define BER_BVC(s)		{ STRLENOF(s), (s) }
>>> +#define BER_BVC(s)		{ STRLENOF(s), (char *)(s) }
>>> (...)
>
>> If it's just for a few cases, how about adding a BER_BVCC macro which
>> takes a const char[] instead?  Or if it's for C++, that can use
>> const_cast<char *>(s).
>
> OK, either of those would be fine if you want to revert this checkin. Though
> we shouldn't use any C++ syntax in these headers.

I'll add BVCC then.  And use it - where?  I don't get any warnings.
In fact I just tried
	#define BER_BVC(s)	{ STRLENOF(s), ("" s "") }
	#define BER_BVSTR(bv,s)	... (bv)->bv_val = ("" s ""); ...
which requires s to be a string constant, and only got one error
back-bdb/index.c:presence_key.

Maybe we should do that as well #if __STDC__?  It gives an error if one
casts away const on s, which changes the result of STRLENOF().

-- 
Hallvard