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

Re: commit: ldap/include lber_pvt.h



Howard Chu writes:
> 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
>> 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().
>
> I'm thinking your original concern is a non-issue. BER_BVC is only
> intended for use with string constants in the first place,

After changing my mind a few times, I agree:-)
A type error looks less likely than than BER_BVC(<char* variable>),
an error the original version did not catch.

> and STRLENOF() will be wrong for non-constants.

Well, it works for char[] = "foo" variables.  Except for that, the hack
I quoted above kind of grew on me.

-- 
Hallvard