Kenneth Graunke <kenn...@whitecape.org> writes:

> On 09/24/2013 11:22 AM, Ian Romanick wrote:
>>[..]
>> Related to my comment on Vinson's patch (see "glsl: Initialize
>> assignment_generator member variables."), we need to come up with some
>> coding conventions.
>> 
>>  - What things should use the initialization list, and what things
>> should be ininitailized in the body of the constructor?
>
> I don't have a strong preference here.  I like initializing fields from
> parameters where both have basically the same name, i.e.
>
> fs_visitor(brw_wm_prog_data *prog_data)
>    : prog_data(prog_data), ...
> {
> }
>

I think I tend to initialize everything from the initializer list unless
it's complex enough to require more than one line.

>>  - Should each initializer go on its own line, or should they be put on
>> fewer lines?
>
> It's a similar situation to function parameters - should you put them on
> a few lines, or one per line?  There's usually a threshold where, for a
> lot of parameters, one per-line makes sense.  I'd prefer not to
> standardize this, and leave it up to individual developers' artistic taste.
>
>>  - What should be the indentation before the ":"?
>
> I think my preference is:
>
> constructor_name(...)
>    : foo(...), bar(...),
>      quux(...), baz(...),
> {
> }
>
> (Colon goes on the line below the instruction, preceded by a standard
> Mesa three space indent, followed by a single space.)
>
> But I'm open to other ideas.
>
This sounds good to me, it's pretty much my preferred initialization
style too.

Thanks.

> --Ken

Attachment: pgpSjpbqkXhDP.pgp
Description: PGP signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to