Watching from above
Legend
- Joined
- Apr 9, 2004
- Messages
- 3,824
- Reaction score
- 746
This recent example says everything about empty lines, indents and namings:
I'm tempted to use short variable names, I always indent, sometimes I comment the end bracket if there's much code between. For single-statement if's I only indent, not use brackets. Also, I usually put empty lines to separate significantly differing code segments. I usually don't have a problem following a previously written program of mine after a while, but I should work on using more describing variable names when it comes to bigger projects. I usually write the code fast and let compiler point out the mistaken names and missing characters and all.
Code:
void CMainWnd::OnPaint()
{
CPaintDC dc(this);
if (play)
{
CHARACTER *chr;
POSITION pos=chars.GetHeadPosition();
for (int i=0; i<chars.GetCount(); i++)
{
chr=&chars.GetNext(pos);
dc.Ellipse(chr->loc.x-3, chr->loc.y-3, chr->loc.x+3, chr->loc.y+3);
**
** //play
**
I'm tempted to use short variable names, I always indent, sometimes I comment the end bracket if there's much code between. For single-statement if's I only indent, not use brackets. Also, I usually put empty lines to separate significantly differing code segments. I usually don't have a problem following a previously written program of mine after a while, but I should work on using more describing variable names when it comes to bigger projects. I usually write the code fast and let compiler point out the mistaken names and missing characters and all.

