comments
orib.dev·282w

orib.dev: Comments on Comments

To paraphrase Philip Wadler, people will talk more about comments than any other aspect of languages. Here’s my blather: Toss it on the pile.

Good comments are worth their weight in gold. Most comments are not good. I’ve coped with code chock full of comments – but the comments were all repetitions of what the code did. To avoid accusations of putting up a straw man, I’m putting in an example from real code I’ve had the displeasure of working with:

/* Check the CRC handle allocation */
if(hcrc == NULL)
{
return HAL_ERROR;
}

/* Check the parameters */
assert_param(IS_CRC_ALL_INSTANCE(hcrc->Instance));

/* Change CRC peripheral state */
hcrc->State = HAL_CRC_STATE_BUSY;

/* DeInit the low...

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help