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

Re: char* parameters -> const char* ?



Kurt D. Zeilenga wrote:
> ...
> >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).
> 
> We could change them like some vendors (ie: Netscape) have.  The only
> issue is how strict do you want to follow the published specs (RFC_1823
> for v2, draft-ietf-ldapext-ldap-c-api-01 for v3) and what problems might
> occur do that change.
> 
> We could make the change conditional.  That is, have a flag -DLDAP_API_STRICT
> or -DLDAP_API_CONST (depending on what we decide the default behavior
> should be) that would define LDAP_CONST appropriately.   The prototypes
> would get a uglier, but it would provide a bit of flexibility.

I don't see how the "const" additions could be anything BUT better for
the API. If the semantic of the arguments is to not change them (as
defined by the RFC), then adding const is just reinforcing that
semantic.

Adding in the macro just serves to complicate the API, it would seem.
What gain would exist from that flexibility?

-g

--
Greg Stein (gstein@lyra.org)