Skip to content

Container and memory allocation guidelines#12387

Merged
yuslepukhin merged 6 commits into
masterfrom
yuslepukhin/rt_coding_standards
Aug 3, 2022
Merged

Container and memory allocation guidelines#12387
yuslepukhin merged 6 commits into
masterfrom
yuslepukhin/rt_coding_standards

Conversation

@yuslepukhin
Copy link
Copy Markdown
Member

Description:
Update and move to a separate section guideline for containers that are memory efficient.

Motivation and Context
This is to promote awareness of the updated coding requirements.

@yuslepukhin yuslepukhin requested a review from edgchen1 August 1, 2022 18:31
Comment thread docs/Coding_Conventions_and_Standards.md Outdated
Comment thread docs/Coding_Conventions_and_Standards.md Outdated
Comment thread docs/Coding_Conventions_and_Standards.md
Comment thread docs/Coding_Conventions_and_Standards.md Outdated
Comment thread docs/Coding_Conventions_and_Standards.md Outdated
Comment thread docs/Coding_Conventions_and_Standards.md Outdated
Comment thread docs/Coding_Conventions_and_Standards.md Outdated
// Use
void foo(gsl::span<const Node* const>);
```
* Prefer returning `gsl::span<const T>` by value instead of a const reference to a contiguous member container. Prefer returning `gsl::span` instead of a pointer referring to a chunk of memory. The size is also included in the span.
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.

Suggested change
* Prefer returning `gsl::span<const T>` by value instead of a const reference to a contiguous member container. Prefer returning `gsl::span` instead of a pointer referring to a chunk of memory. The size is also included in the span.
* Prefer returning `gsl::span<const T>` by value instead of a const reference to a contiguous member container. Prefer returning `gsl::span` instead of a pointer referring to a chunk of memory as the size is also included in the span.

as suggested by @skottmckay

Copy link
Copy Markdown
Contributor

@edgchen1 edgchen1 left a comment

Choose a reason for hiding this comment

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

looks good to me, perhaps have others review too

@yuslepukhin yuslepukhin merged commit dc984a0 into master Aug 3, 2022
@yuslepukhin yuslepukhin deleted the yuslepukhin/rt_coding_standards branch August 3, 2022 17:32
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