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:
Pranav Sharma 2019-09-04 19:16:16 -07:00 committed by GitHub
parent 3d44c55092
commit 7c5b3a5ecc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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