[cfe-dev] Default arguments considered harmful?
Chandler Carruth
chandlerc at google.com
Sat May 3 01:40:58 PDT 2014
On Fri, May 2, 2014 at 5:04 PM, Richard <legalize at xmission.com> wrote:
> When I have lots of parameters that control creating an object, I tend
> to prefer a "builder" interface that gives me readable code,
> reasonable defaults
>
This only works if you have reasonable defaults for all of the parameters
(see Reid's comments). If there is a mixture of reasonable defaults and
important parameters, a builder which requires the important ones in the
constructor and allows you to override the defaults of the rest is quite
reasonable though. It isn't clear whether this is such a case, but it might
be.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140503/604ae3a7/attachment.html>
More information about the cfe-dev
mailing list