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

Re: commit: ldap/include lber_pvt.h

Hallvard B Furuseth wrote:
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.

I'm only getting warnings from g++.
../../../servers/slapd/back-ndb/init.cpp:40: warning: deprecated conversion from string constant to 'char*'

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

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().

I'm thinking your original concern is a non-issue. BER_BVC is only intended for use with string constants in the first place, and STRLENOF() will be wrong for non-constants.
-- Howard Chu
Chief Architect, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/