[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: char* parameters -> const char* ?
Hallvard B Furuseth wrote:
>
> Greg Stein writes:
> > Adding in the macro just serves to complicate the API, it would seem.
> > What gain would exist from that flexibility?
>
> Well, some C++ programs might care.
> A program may expect the library to follow the rfc's prototype - like
> int (*add) ( LDAP *, char *, LDAPMod ** );
> add = (async ? ldap_add : ldap_add_s);
> You can remove the prototype above in C, but not in C++.
>
> But the LDAP C API doesn't encourage such code anyway since few
> functions have the same prototypes. So I guess the main benefit is to
> be able to say "we follow the standard (rfc1823)":-)
Quite true. Although if the C++ programmer put "const" in there, then it
would work against all libraries since the prototype'd variable can be
bound against a function w/o const in it. (but you can't bind non-const
against a const function!)
-g
--
Greg Stein (gstein@lyra.org)