Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

D2LXXXX: ban default constructor of certain structs #510

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

omsmith
Copy link
Contributor

@omsmith omsmith commented Jun 19, 2019

This is a generic version of, and supercedes D2L0029.

Includes codefixes to use the initializer for the likely-to-be-intended
usecase. This may be a miss for some things, such as Guid.Empty vs
Guid.NewGuid(). Could theoretically suggest both.

@omsmith omsmith requested a review from j3parker as a code owner June 19, 2019 13:52
GeneratedCodeAnalysisFlags.None
);

context.RegisterOperationAction(
Copy link
Member

Choose a reason for hiding this comment

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

Might want to handle = default( T ) at some point

Copy link
Member

Choose a reason for hiding this comment

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

From IRL: = default( T ) is pretty explicit so maybe don't ban it.

@omsmith omsmith force-pushed the omsmith/dont-call-default-struct-constructor branch from b254c4d to 2611ff8 Compare June 19, 2019 18:07
@omsmith omsmith changed the title D2LXXXX: don't call default construct of a struct D2LXXXX: ban default constructor of certain structs Jun 19, 2019
@omsmith omsmith force-pushed the omsmith/dont-call-default-struct-constructor branch from 2611ff8 to 456187f Compare June 19, 2019 18:22
j3parker
j3parker previously approved these changes Jun 19, 2019
This is a generic version of, and supercedes D2L0029.

Includes codefixes to use the initializer for the likely-to-be-intended
usecase. This may be a miss for some things, such as Guid.Empty vs
Guid.NewGuid(). Could theoretically suggest both.
@omsmith omsmith force-pushed the omsmith/dont-call-default-struct-constructor branch from 456187f to 12e41c4 Compare June 19, 2019 19:15
@omsmith omsmith requested a review from mthjones as a code owner November 20, 2020 00:06
@mthjones mthjones removed their request for review March 10, 2021 15:38
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.

2 participants