Skip to content

STYLE: Remove inline from in-class member functions in "itk*.h" - #7187

Merged
hjmjohnson merged 1 commit into
InsightSoftwareConsortium:mainfrom
N-Dekker:Remove-inline-from-in-class-member-functions
Nov 18, 2026
Merged

hjmjohnson merged 1 commit into
InsightSoftwareConsortium:mainfrom
N-Dekker:Remove-inline-from-in-class-member-functions

Conversation

@N-Dekker

@N-Dekker N-Dekker commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Replaced ^( [^\r\n]*)inline ([^;\\]+\r\n {) with $1$2, using Notepad++ (Search mode: Regular expression).

Member functions that are defined inside their class definition are already implicitly inline, so for these member functions, the inline keyword appears redundant.

@github-actions github-actions Bot added area:Python wrapping Python bindings for a class area:Core Issues affecting the Core module area:Filtering Issues affecting the Filtering module area:IO Issues affecting the IO module area:Registration Issues affecting the Registration module area:Segmentation Issues affecting the Segmentation module type:Style Style changes: no logic impact (indentation, comments, naming) area:Numerics Issues affecting the Numerics module labels Nov 17, 2026

@dzenanz dzenanz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good on a glance.

@N-Dekker

Copy link
Copy Markdown
Contributor Author

Looks good on a glance.

Thanks @dzenanz It's really a matter of taste, of course. I think it's most common to avoid the inline keyword for in-class member function definitions. It has no effect at all.

@N-Dekker
N-Dekker force-pushed the Remove-inline-from-in-class-member-functions branch 2 times, most recently from 13614c7 to 43f45c3 Compare November 17, 2026 20:18
@hjmjohnson

Copy link
Copy Markdown
Member

I'm fine with this. I like being explicit because I often work with new developers or scientists who aren't experts in C++ nuances.

@N-Dekker

Copy link
Copy Markdown
Contributor Author

I'm fine with this. I like being explicit because I often work with new developers or scientists who aren't experts in C++ nuances.

Thanks Hans. Unfortunately I think it's a bit difficult to explain the meaning of the inline keyword to a non-expert. Calls to a function that is marked inline might be inline-expanded by the compiler. But the compiler does not really need an inline keyword, in order to do inline-expanding. When the function is small and its definition is visible at the call site, the compiler is likely to do inline-expansion, even without having an inline keyword.

For member functions that are defined inside their class definition, the inline keyword has no effect at all, by definition. For template functions and template class member functions, the inline keyword has no effect either, in practice.

@N-Dekker
N-Dekker marked this pull request as ready for review November 17, 2026 20:52
@greptile-apps

greptile-apps Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5 Tier: apex

[Low impact] The PR changes source spelling across many ITK headers without changing runtime behavior.

Restore the missing word before merging to meet the project's source-comment standard.

Findings

  1. P2 Comment loses its explanation ▶

Summary

This style cleanup removes redundant inline keywords from functions defined inside classes across ITK headers, without changing their C++ behavior.

  • In-class member functions lose only the redundant explicit inline spelling.

Reviews (1) · Last reviewed commit: "STYLE: Remove `inline` from in-class mem..." · Reviewed by Greptile

/** Set the segmentation function. In general, this should only be
* called by a subclass of this object. It is made public to allow
* itk::Command objects access. The method is inline to avoid a
* itk::Command objects access. The method is to avoid a

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Comment loses its explanation

Removing inline here leaves “The method is to avoid a problem,” without saying what avoids it. The project standard requires source comments to explain why the code is written this way. Restore this word: SetSegmentationFunction is still defined in the class and remains implicitly inline.

Suggested change
* itk::Command objects access. The method is to avoid a
* itk::Command objects access. The method is inline to avoid a

Context Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@greptile-apps Addressed by the most recent force-pushed amend, please check!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Confirmed—the amended revision restores “inline” in the comment at Modules/Segmentation/LevelSets/include/itkSegmentationLevelSetImageFilter.h. It now reads “The method is inline to avoid a problem with the gcc 2.95 compiler matching the declaration with the definition,” so this concern is addressed.

Replaced `^(  [^\r\n]*)inline ([^;\\]+\r\n  {)` with `$1$2`, using Notepad++ (Search mode: Regular expression).

Member functions that are defined inside their class definition are already implicitly inline, so for these member functions, the `inline` keyword appears redundant.
@N-Dekker
N-Dekker force-pushed the Remove-inline-from-in-class-member-functions branch from 43f45c3 to 4bdcfcf Compare November 17, 2026 21:04
@hjmjohnson
hjmjohnson merged commit e9c58bb into InsightSoftwareConsortium:main Nov 18, 2026
19 checks passed
hjmjohnson pushed a commit that referenced this pull request Nov 19, 2026
Replaced `^(    [^\r\n]*)inline ([^;\\]+\r\n    {)` with `$1$2`, using Notepad++ (Search mode: Regular expression).

Follow-up to pull request #7187 commit 4bdcfcf 'STYLE: Remove `inline` from in-class member functions in "itk*.h"'
hjmjohnson pushed a commit that referenced this pull request Nov 19, 2026
Follow-up to pull request #7187 commit 4bdcfcf 'STYLE: Remove `inline` from in-class member functions in "itk*.h"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Core Issues affecting the Core module area:Filtering Issues affecting the Filtering module area:IO Issues affecting the IO module area:Numerics Issues affecting the Numerics module area:Python wrapping Python bindings for a class area:Registration Issues affecting the Registration module area:Segmentation Issues affecting the Segmentation module type:Style Style changes: no logic impact (indentation, comments, naming)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants