Skip to content

COMP: Fix MSVC warning C26495: m_PositionIndex uninitialized#3849

Merged
dzenanz merged 1 commit intoInsightSoftwareConsortium:masterfrom
N-Dekker:Fix-Variable-uninitialized-ImageConstIteratorWithIndex
Jan 4, 2023
Merged

COMP: Fix MSVC warning C26495: m_PositionIndex uninitialized#3849
dzenanz merged 1 commit intoInsightSoftwareConsortium:masterfrom
N-Dekker:Fix-Variable-uninitialized-ImageConstIteratorWithIndex

Conversation

@N-Dekker
Copy link
Copy Markdown
Contributor

@N-Dekker N-Dekker commented Jan 4, 2023

Fixed VS2019 Code Analysis warnings, saying:

warning C26495: Variable 'm_PositionIndex' is uninitialized.
Always initialize a member variable (type.6)

Also added in-class default member initializers to three other data members that were not yet initialized by the default-constructors of ImageConstIteratorWithIndex and ImageConstIteratorWithOnlyIndex.

Note that ImageConstIteratorWithIndex<TImage> and ImageConstIteratorWithIndex<TImage> are rather "expensive" classes (having a virtual table) and their default-constructors are already non-trivial, so the extra cost of the added initialization appears relatively low.

Fixed VS2019 Code Analysis warnings, saying:
> warning C26495: Variable 'm_PositionIndex' is uninitialized.
> Always initialize a member variable (type.6)

Also added in-class default member initializers to three other data members that
were not yet initialized by the default-constructors of
ImageConstIteratorWithIndex and ImageConstIteratorWithOnlyIndex.

Note that `ImageConstIteratorWithIndex<TImage>` and
`ImageConstIteratorWithIndex<TImage>` are rather "expensive" classes (having a
virtual table) and their default-constructors are already non-trivial, so the
extra cost of the added initialization appears relatively low.
@github-actions github-actions Bot added area:Core Issues affecting the Core module type:Compiler Compiler support or related warnings labels Jan 4, 2023
@N-Dekker N-Dekker marked this pull request as ready for review January 4, 2023 15:22
@dzenanz dzenanz merged commit de142a0 into InsightSoftwareConsortium:master Jan 4, 2023
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 type:Compiler Compiler support or related warnings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants