[Mesa-dev] [PATCH 01/11] glsl: Initialize all member variables of _mesa_glsl_parse_state on construction.
Francisco Jerez
currojerez at riseup.net
Tue Sep 24 12:07:48 PDT 2013
Kenneth Graunke <kenneth at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 229 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130924/68dc04db/attachment.pgp>
More information about the mesa-dev
mailing list