Skip to content

Pass by reference when null is not expected - #4546

Merged
sharwell merged 1 commit into
dotnet:masterfrom
sharwell:pass-by-ref
Dec 8, 2019
Merged

sharwell merged 1 commit into
dotnet:masterfrom
sharwell:pass-by-ref

Conversation

@sharwell

@sharwell sharwell commented Dec 8, 2019

Copy link
Copy Markdown
Contributor

No description provided.

@sharwell
sharwell requested a review from a team as a code owner December 8, 2019 00:33
@sharwell sharwell mentioned this pull request Dec 8, 2019
@codecov

codecov Bot commented Dec 8, 2019 •

Copy link
Copy Markdown

Codecov Report

Merging #4546 into master will increase coverage by <.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #4546      +/-   ##
==========================================
+ Coverage    75.1%   75.11%   +<.01%     
==========================================
  Files         908      908              
  Lines      160260   160260              
  Branches    17259    17259              
==========================================
+ Hits       120369   120379      +10     
+ Misses      35070    35067       -3     
+ Partials     4821     4814       -7
Flag Coverage Δ
#Debug 75.11% <ø> (ø) ⬆️
#production 70.51% <ø> (ø) ⬆️
#test 90.26% <ø> (ø) ⬆️
Impacted Files Coverage Δ
src/Microsoft.ML.AutoML/Sweepers/Parameters.cs 78.81% <0%> (-4.24%) ⬇️
...soft.ML.Data/DataLoadSave/Text/TextLoaderCursor.cs 84.7% <0%> (-0.41%) ⬇️
...ML.Transforms/Text/StopWordsRemovingTransformer.cs 86.1% <0%> (-0.16%) ⬇️
src/Microsoft.ML.Maml/MAML.cs 26.21% <0%> (+1.45%) ⬆️
...rosoft.ML.AutoML/ColumnInference/TextFileSample.cs 62.25% <0%> (+2.64%) ⬆️
....ML.AutoML/PipelineSuggesters/PipelineSuggester.cs 86.55% <0%> (+6.72%) ⬆️
...c/Microsoft.ML.FastTree/Utils/ThreadTaskManager.cs 100% <0%> (+20.51%) ⬆️

@codemzs codemzs 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.

:shipit:

@codemzs

codemzs commented Dec 8, 2019

Copy link
Copy Markdown
Member

Thanks but can you please the rationale for passing by reference instead of pointers?

@sharwell

sharwell commented Dec 8, 2019

Copy link
Copy Markdown
Contributor Author

The method uses the object without checking it for null, so it's clear that it never expects a null pointer as input. References are an idiomatic way of expressing intent in C++ that the input is not expected to be null, and is used by the method but not stored by the method for later use (i.e. the scope of use extends to the return from the method, and no further).

@sharwell
sharwell merged commit a4b4660 into dotnet:master Dec 8, 2019
@sharwell
sharwell deleted the pass-by-ref branch December 8, 2019 17:42
@ghost ghost locked as resolved and limited conversation to collaborators Mar 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants