3 ms·
A decent point. Google uses the pointer-ness or const-reference-ness of a parameter to signal what the parameter is going to be used for [1]. But at the end of
by jamesaguilar 16y ago
A decent point. Google uses the pointer-ness or const-reference-ness of a parameter to signal what the parameter is going to be used for [1]. But at the end of the day reference modification is the kind of basic language feature that you should expect to see people using.
[1] http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml http://google-styleguide.googlecode.com/svn/trunk/cppguide.x...
- leif 16y agoThis actually bothered me to no end at google. At the API level, it's great, I can learn a lot about what your function is going to do just by looking at the signature, but when reading code that uses an API I don't know, it's hell. For me, the extra help you get by looking at a function signature really isn't that great, when I should have the same information available in the documentation that had damn well better accompany the function signature in your header.
- jamesaguilar 16y agoHeader documentation and pointer-as-output conventions are both typically available in the Google libraries I've used. I really don't understand what you are complaining about. Earlier you said you didn't like references being modified by functions to which they are parameters. Now you are complaining about the use of pointers as parameters? In a language like C++, it's pretty difficult to do neither.
- leif 16y agoNo, I'm not opposed to references being modified by functions, I'm opposed to the "ampersand" syntax of C++. I am fully in support of just passing a pointer and being straightforward about it.