[SERVER-71412] update server C++ code style for output parameters Created: 16/Nov/22  Updated: 29/Oct/23  Resolved: 09/Dec/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.3.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Benety Goh Assignee: Benety Goh
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Execution Team 2022-12-12
Participants:

 Description   

TLDR: Reinforce the Google C++ Style Guide recommendation for using references for output parameters; or explicitly recommend pointers for outputs.

The Server Code Style currently defaults to the Google C++ Style Guide in areas where we do not provide any explicit guidance.

The guidance for Inputs and Outputs currently recommends using references for output parameters. This is a recent shift from the version of the style guide most of the MongoDB codebase was written against. The guidance before this change in the Google style guide was to use pointers for output parameters.



 Comments   
Comment by Benety Goh [ 09/Dec/22 ]

The mongo repo wiki was updated to highlight the inconsistency between the current Google C++ Style and our application of the previous guidance. We can open a new ticket if there is interest in taking a position on this style guideline.

Comment by Benety Goh [ 22/Nov/22 ]

Server Code Style updated with Output Parameters section:

https://github.com/mongodb/mongo/wiki/Server-Code-Style/e59e860af46f7807a251c89f5dc48d5932a750f0#output-parameters

Comment by Matt Kneiser [ 22/Nov/22 ]

Leave note in the style guide pointing out that Google's guidance has changed.

Generated at Thu Feb 08 06:18:56 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.