Google C++ Style Guide
-
They're a tad too strict for my taste. If you're going to be telling people where to put their ++, you're focusing on the wrong thing.
-
Good reading, but some points I'd rather to change...
As I am reading more, I am glad to we have Qt "style"...
-
Heh, back to good old plain C again:
@Object *o = new Object;
o->init();@@struct Object *o = malloc(sizeof(struct Object));
ObjectInit(o);@ -
Yes, yes...C# uses it too ((void) Init() functions)
Google Style Guide is too strict for me...
-
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++.
-
@Franzk: I totally agree with you.
[quote author="Franzk" date="1305574936"]Programmers are usually free form thinkers.[/quote]
I am too ;-) -
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! :)
-
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 -
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
};@ -
I wonder, do trolls have analog cpplint.py?:)
-
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.
-
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
-
Wow, we've got our own coding style, that's nice :D :)
-
[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) :-)
-
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?