Commenting above or below the line?

Started by
4 comments, last by d0hboy 20 years, 3 months ago
Ok, I have to admit this is retardedly trivial, but what looks better in terms of coding / style convention?

// set a 2D parallel projection view
//		 left	right	bottom	top		zNear	zFar
glOrtho( 0.0,	w,		h,		0.0,	0.0,	100.0 );
 
OR

// set a 2D parallel projection view
glOrtho( 0.0,	w,		h,		0.0,	0.0,	100.0 );
//		 left	right	bottom	top		zNear	zFar
 
It didn''t really dawn on me the difference until I played around with it and wondered what an industrial strength coder would do.
Advertisement
I think it''s like you want it. If you prefer above, then do above. If u work with other people, tell them to pick one convention, then it is easier for everybody to read.

Kiruagon
Be cool, be sexy, be GDer...
It really doesn''t matter, just as long as you are consistent throughout all your code. So if you want to go with the lower one (which does look pretty ok) you need to do it throughout all source files, otherwise confusion might arise.

Then later, if you get employed at a company that has their own convention of writing comments then you''ll have to stick to it.

If you ask me, I''d do it like this if I had to know the various variables:

// set a 2D parallel projection viewglOrtho( 0.0,w,h,0.0,0.0,100.0 );   // left, right, bottom, top, non-important, zNear, zFar 
-----------------------------Final Frontier Trader
//pretty!;)glOrtho( 0.0,    /* left */         w,      /* right */         h,      /* bottom */         0.0,    /* top */         0.0,    /* zNear */         100.0,  /* zFar */       );



------------------------------------------------------------
// TODO: Insert clever comment here.
------------------------------------------------------------// TODO: Insert clever comment here.
drowner :hehe.. I''ve seen something like that as well.. In fact, in many ways that''s usually preferred.. But that could be just me..

In the end, it all comes down to follow your team''s coding style.. If you are all by yourself, then it''s whatever you feel like.
How about using aptly-named variables? No comments needed:

glOrtho(left, right, bottom, top, near, far);


--
Dave Mikesell Software & Consulting

This topic is closed to new replies.

Advertisement