[Development] Coding style proposal

Konstantin Ritt ritt.ks at gmail.com
Thu Jan 2 08:34:21 CET 2014


1. In cpp, we typically use enums for numeric constants. In Qt coding
style, enums are in CamelCase.
2. Just a wasting of time. Simply use generated documentation rather than
scroll over the header files (Qt docs are very good, you know).

Regards,
Konstantin


2014/1/2 Jiergir Ogoerg <f35f22fan at gmail.com>

> Hi,
>
> 1. Constant names
> Typically constants are named UPPER_CASE which is slightly annoying
> (looks like shouting) and look like macros which are also named upper case.
>
> I'd propose naming constants with a lowercase "k" followed by camel case:
> const int kMonthCount = 12;
>
> It makes it easy to distinguish them from macros.
> I read this idea on Google's C++ coding style page and use it myself now
> for my
> projects.
>
> Should apply to global constants, those local to functions/methods should
> be
> named at will since their scope is limited.
> Current constants shouldn't be rewritten, just the code from now on.
>
>
> http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Constant_Names
>
> Again, not because Google does so, but because I found the idea good.
>
> 2. Methods in alphabetic order
> This one is less likely to be adopted because a lot of classes' methods
> would need to be rearranged and nobody has that much time. Nonetheless.
> The methods of the classes (except ctors and dtors) can be arranged
> alphabetically so
> that when you think of a method you know which way (up or down) you need to
> scroll and basically you know in advance where to find it.
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20140102/11eb64b7/attachment.html>


More information about the Development mailing list