[gdal-dev] Refactoring: class members clean-up

Mateusz Loskot mateusz at loskot.net
Fri Oct 16 10:50:47 PDT 2015


On 16 Oct 2015 19:30, "Even Rouault" <even.rouault at spatialys.com> wrote:
> Le vendredi 16 octobre 2015 18:11:17, Mateusz Loskot a écrit :
> > Hi,
> >
> > I noticed Kurt has been applying lots of non-functional code
improvements,
> > refactoring, and cleaning compilation warnings, etc.
> >
> > I have been considering similar clean-up also to unify class member
names
> > which often lead to compilation warnings due to declaration hiding.
> >
> > I committed a short example of such refactoring:
> > https://trac.osgeo.org/gdal/changeset/31023
> >
> > Would that be something acceptable across the whole source code?
>
> I guess Kurt will point to
>
https://google-styleguide.googlecode.com/svn/trunk/cppguide.html#Variable_Names
> with the blabla_ convention ;-)
>
> This underscore suffix convention is used in very few places, mainly the
(old) KML driver AFAIK
>
> The m_ convention is used a bit more often in the GDAL code base.

I'm not proposing any changes to naming convention. AFAICT, currently GDAL
either uses m_ prefix or nothing.
I will keep using g the m_ prefix, so the trailing underscore is out of
discussion from my point.

> If we adopt any convention, this should be added to
https://trac.osgeo.org/gdal/wiki/rfc8_devguide

I haven't checked the page but I assume it should be m_

> Personnaly I find the m_ convention more readable as the trailing
underscore
> is easy to miss, but perhaps that is the intention ?

My personal preference is the trailing underscore, but that is irrelevant
as I'm going to follow the code base.

> Whatever convention would be used, I'd advise not to apply it to public or
> protected members of GDAL exported classes (like the ones of
gcore/gdal_priv.h),
> because that could break external plugins. Or that would require more
advertizing of the change.

Good point. OK.

> > I'm willing to join Kurt's efforts.
>
> Some coordination might be required to avoid stepping on each other toes.

Sure. That's why I mentioned Kurt hoping he will chime in.

Mateusz Łoskot
(Sent from mobile)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20151016/24bb5791/attachment.html>


More information about the gdal-dev mailing list