Google C++ Style Guide
-
wrote on 16 May 2011, 19:42 last edited by
I think the Google style guide documents the exact mistake a lot of companies make when they are prescribing the style this specifically. Programmers are usually free form thinkers. Putting a too rigid harness on that free form thinking lets developers focus on form rather than on functionality, and frankly, I'd rather have a bit of functionality. If you want to restrict coding rigidly to a certain standard, use a language that isn't as free form as C++.
-
wrote on 16 May 2011, 21:15 last edited by
Volker, thanks for sharing! It is always good to know how leading companies work.
[quote author="Andre" date="1305548881"]Personally, I really like the Qt convention that class names start with a capital, and method names with a lower case letter. That is different in the Google conventions. [/quote]
Yes it is really nice, although I have to admit that I am still getting used to it :)
[quote author="Franzk" date="1305574936"]I think the Google style guide documents the exact mistake a lot of companies make when they are prescribing the style this specifically. Programmers are usually free form thinkers. Putting a too rigid harness on that free form thinking lets developers focus on form rather than on functionality, and frankly, I'd rather have a bit of functionality. If you want to restrict coding rigidly to a certain standard, use a language that isn't as free form as C++.[/quote]
+1 :) Bull's eye! :)
-
wrote on 16 May 2011, 21:48 last edited by
I prefer Unix or BSD style, it's not so strict as Google has...
Joke:
But the best thing that they wrote, was: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=C++0x#C++0x
" Decision: Use only C++0x libraries and language features that have been approved for use. Currently, no such features are approved. Features will be approved individually as appropriate."
How can I use C++0x (as it Google said), if there is just specification out?? Think smarter and you'll get nonsense of using this Google Style :D -
wrote on 17 May 2011, 05:32 last edited by
Preliminary implementations, which is why no libraries at all are approved. But one can hardly expect the trailing comma in enumerators to be a library function.
@enum HuuHaa {
Murk, // c++0x specific feature
};@ -
wrote on 17 May 2011, 09:23 last edited by
I wonder, do trolls have analog cpplint.py?:)
-
wrote on 18 May 2011, 22:39 last edited by
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Inline_Functions
Does Qt encourage inline functions inside the library which can be called from user code ? I guess it could cause binary incompatibilities if definition of inline function changes between library versions.
-
wrote on 18 May 2011, 22:57 last edited by
Inline functions are not strongly en- ord discouraged, but the "Coding Conventions":http://developer.qt.nokia.com/wiki/Coding_Conventions section "Binary and Source Compatibility":http://developer.qt.nokia.com/wiki/Coding_Conventions#017d38d16f3e68ae84e92996ba58c513 requires not to reimplement them (dunno if a change to the code itself would be ok) under certain circumstances.
Inline functions an B/C are a special beast, which would lead to use this feature only for short code blocks that are unlikely to change. I second the guidelines of Google here (excluding the -inl.h files).
EDIT:
To add the Qt counterparts for comparison:- "Qt Coding Conventions":http://developer.qt.nokia.com/wiki/Coding_Conventions
- "Qt Coding Style":http://developer.qt.nokia.com/wiki/Qt_Coding_Style
-
wrote on 19 May 2011, 16:17 last edited by
Wow, we've got our own coding style, that's nice :D :)
-
wrote on 19 May 2011, 22:31 last edited by
[quote author="Peppy" date="1305821823"]Wow, we've got our own coding style, that's nice :D :) [/quote]
Of course - every good project does have its style guide (or adopts an existing one) :-)
-
wrote on 9 May 2013, 11:39 last edited by
Hi guys,
I would like to know how to import the google-style-code in qtcreator, any idea?
Is it possible as fast as import or I need to modify a xml file?