Skip to content

Fix indent comment alignment rule 3#1372

Merged
gmaurel merged 2 commits intouncrustify:masterfrom
KVic:fix-indent-comment-alignment
Oct 12, 2017
Merged

Fix indent comment alignment rule 3#1372
gmaurel merged 2 commits intouncrustify:masterfrom
KVic:fix-indent-comment-alignment

Conversation

@KVic
Copy link
Copy Markdown
Contributor

@KVic KVic commented Oct 9, 2017

Also this fixes issue #1287.

if (next_nl == NULL || next_nl->nl_count > 1)
{
// FIXME: Max thresh magic number 5000
return(5000);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use int and return -1 here to express an invalid value. Also, the name of the function could contain abs to clarify that.

There is no need to use size_t here.

Copy link
Copy Markdown
Contributor Author

@KVic KVic Oct 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The int(-1) is also a magic number :). A std::optional should be used here, but this is a С++17. The magic number size_t(5000) is widely used in the options.cpp. It must be replaced everywhere with some constant, such as std::numeric_limits<size_t>::max().

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with -1. I'm was just arguing against using size_t, and any other unsigned values, for anything other than sizes or bit-field operations. They introduce a lot of problems when used along with int due to implicit integer promotions.

@mihaipopescu
Copy link
Copy Markdown
Collaborator

Thanks for looking into this one.

@gmaurel gmaurel merged commit 0cf1267 into uncrustify:master Oct 12, 2017
@KVic KVic deleted the fix-indent-comment-alignment branch October 14, 2017 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants