Difference between revisions of "Talk:Code Style"
(Questions were resolved.) |
(Added a long function call style proposal.) |
||
Line 1: | Line 1: | ||
+ | == Code style proposals == | ||
+ | === Long function call alignment and indentation === | ||
+ | '''Break up a function call into two or more lines if it reaches an uncomfortable length. Use one tab of indentation for the additional lines.''' | ||
+ | |||
+ | '''YES:''' | ||
+ | |||
+ | glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, (GLsizei) width, (GLsizei) height, | ||
+ | ⇥GL_RGBA, GL_UNSIGNED_BYTE, data->getData()); | ||
+ | |||
+ | '''NO:''' | ||
+ | |||
+ | glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, (GLsizei) width, (GLsizei) height, | ||
+ | ················GL_RGBA, L_UNSIGNED_BYTE, data->getData()); | ||
+ | |||
+ | glTexSubImage2D(GL_TEXTURE_2D, | ||
+ | ················0, | ||
+ | ················0, | ||
+ | ················0, | ||
+ | ················(GLsizei) width, | ||
+ | ················(GLsizei) height, | ||
+ | ················GL_RGBA, | ||
+ | ················GL_UNSIGNED_BYTE, | ||
+ | ················data->getData()); | ||
+ | |||
+ | --[[User:Boolsheet|Boolsheet]] 13:14, 7 January 2013 (GMT) |
Revision as of 13:14, 7 January 2013
Code style proposals
Long function call alignment and indentation
Break up a function call into two or more lines if it reaches an uncomfortable length. Use one tab of indentation for the additional lines.
YES:
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, (GLsizei) width, (GLsizei) height, ⇥GL_RGBA, GL_UNSIGNED_BYTE, data->getData());
NO:
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, (GLsizei) width, (GLsizei) height, ················GL_RGBA, L_UNSIGNED_BYTE, data->getData()); glTexSubImage2D(GL_TEXTURE_2D, ················0, ················0, ················0, ················(GLsizei) width, ················(GLsizei) height, ················GL_RGBA, ················GL_UNSIGNED_BYTE, ················data->getData());
--Boolsheet 13:14, 7 January 2013 (GMT)