[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: convention for declaring pointers?
From: |
Mike Miller |
Subject: |
Re: convention for declaring pointers? |
Date: |
Sun, 23 Apr 2017 22:40:35 -0700 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
On Sun, Apr 23, 2017 at 22:15:27 -0700, Rik wrote:
> jwe,
>
> Is there a convention for whether to cuddle the '*' for pointers with the
> variable name, variable type, or neither? I noticed in
> liboctave/array/idx-vector.h declarations such as the following
>
> idx_range_rep * r = dynamic_cast<idx_range_rep *> (rep);
>
> I started to change this to
>
> idx_range_rep *r = ...
>
> but then I realized that maybe the extra space is good. It is consistent
> with the rest of Octave coding conventions which tends to emphasize extra
> whitespace for readability. The space between the name of a function and
> the opening parenthesis is an example of this openness.
I've always seen the style
idx_range_rep *r = ...
preferred, and I think we pretty consistently prefer that in Octave so
far. It also helps emphasize that the '*' is required for each
declaration in a compound declaration like
octave_idx_type *ridx, *cidx;
GNU indent also corrects the string "int * x" to "int *x".
--
mike