mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-16 21:00:14 +00:00
Update coding guidelines to prefer using make_unique for heap allocations (unless where not possible). (#1730)
* Mention OrtCreateSessionFromArray in C API doc * Fix perf test executable due to removal of certain C APIs * fix linux build * Avoid duplication * Update coding guidelines to prefer using make_unique for heap allocations (unless where not possible).
This commit is contained in:
parent
3d44c55092
commit
7c5b3a5ecc
1 changed files with 4 additions and 0 deletions
|
|
@ -26,6 +26,10 @@ Other
|
|||
* Don't use else after return. see: [https://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return](https://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return)
|
||||
* Don't overuse std::shared\_ptr. Use std::shared\_ptr only if it's not clear when and where the object will be deallocated. See also: [https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-shared_ptr](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-shared_ptr)
|
||||
* Avoid using the 'long' type, which could be either 32 bits or 64 bits.
|
||||
* If there is a legitimate need to allocate objects on the heap, prefer using std::make_unique(). References for the reasoning:
|
||||
* https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rh-make_unique
|
||||
* https://herbsutter.com/2013/05/29/gotw-89-solution-smart-pointers/
|
||||
* https://abseil.io/tips/126
|
||||
|
||||
#### Clang-format
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue