apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob Rossi <...@brasko.net>
Subject Re: dbd p[v]b functions problem
Date Thu, 04 Feb 2010 23:06:08 GMT
On Fri, Feb 05, 2010 at 09:51:59AM +1100, Bojan Smojver wrote:
> On Thu, 2010-02-04 at 17:44 -0500, Bob Rossi wrote:
> > Is this a design decision or a flaw? 
> 
> Design decision.
> 
> Just to be clear, you are getting segfaults when you are NOT passing
> pointers in, correct?

Correct.

> If you are doing that, you are misusing the API and causing the segfaults.

Wow, I can't believe this is a design decision. It makes no sense to
force the user to pass a pointer like this. It creates a burden
on the user to make an lvalue for the constant. (Perhaps there are
reasons unknown to me that forced this api to behave this way?)

If you are bent on preserving this interface, does a new interface
make sense, that allows the user to pass in the parameters,
without passing in addresses?

At this point, I either have to force the clients of my interface
to pass in only pointers, or to pass in all strings followed by
a NULL parameter. Each of these cases can be easily messed up,
causing a segfault!

It makes much more sense, in my mind, to follow the traditional
variadic parameter approach like printf..., this interface is
very hard to screw up by accident.

Bob Rossi

Mime
View raw message