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

char* parameters -> const char* ?



I am writing a C++ wrapper class(s) for the ldap client stuff, and was
wondering about a small change that would make things a little cleaner.
for functions such as: ldap_bind(), which take char* arguments, it
requires a bit of casting nastiness to get things in order. for example,
assuming who and cred are strings:

	ldap_bind(lp,
	          const_cast<char* >(who.c_str()),
                  const_cast<char* >(cred.c_str()),
	          LDAP_SIMPLE_AUTH
                 );

now, this assumes that bind isn't going to DO anything to my char*'s I
have past in. I was wondering:

a) do functions like ldap_bind() alter the char* arguments? (as a
correlary, will the ldap code alter the char**'s used in rebindproc
calls.)

b) if no changes are made, would it be possible to change the
declaration of these functions to include const char*, which would
provide a reassurance about what the code is in fact doing. (and allow
the use of standard C++ strings without casting).

I would be willing to make the changes myself, and send in a patch, but
being new to this, don't know what the process is, and/or how the
project is being run. Any advice would be appreciated

Cheers,
tim