Curl wrapper round two

Jonathan M Davis jmdavisProg at gmx.com
Sun Jun 19 04:39:36 PDT 2011


On 2011-06-19 04:26, Max Klyga wrote:
> On 2011-06-19 12:44:57 +0300, jdrewsen said:
> > Den 19-06-2011 11:12, Johannes Pfau skrev:
> >> Jimmy Cao wrote:
> >>> Also, why the bool dummy argument in the Curl struct constructor?
> >> 
> >> I guess that's because structs can't have default constructors. Is
> >> there a better solution to this problem?
> > 
> > That is why yes. I could just make a static "create()" function
> > instead, but I went for this model. I would very much like to know a
> > better solution.
> 
> Declare static opCall and then to instatiate:
>     auto foo = Bar();
> But the user must remember to initialize variables properly.

That's why I _always_ use that syntax when declaring variables, unless I 
really do want init. But while it is a good habit to get into, there's no 
guarantee that the user will have such a habit. But given the inherent issues 
with default constructors and structs, there really isn't much else that we 
can do about it.

- Jonathan M Davis


More information about the Digitalmars-d mailing list