forked from TileDB-Inc/TileDB
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from TileDB-Inc/ss/cpp-guidelines
Add C++ Style Guide
- Loading branch information
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Memory Guidelines | ||
|
||
## Pointers and Allocations | ||
|
||
The use of `new` or `malloc` is forbidden unless justifcation and a team | ||
agreement on an exception is granted. Inplace a smart pointer should be used. | ||
|
||
That is a `unique_ptr`, `shared_ptr` or `weak_ptr` should be used in all cases. | ||
With `weak_ptr` being rarely used. | ||
|
||
In the core TileDB library we have our own `tdb_unique_ptr` and `tdb_shared_ptr` | ||
that must be used inplace of the `stl` versions. | ||
|
||
`make_unique_ptr` or `make_shared_ptr` is the preferred, exception safe, method | ||
of creating the smart pointers. | ||
|
||
Extreme care must be given to all allocations. Even when using STL containers | ||
like `std::vector` thoughtful consideration must be given for the dynamic | ||
allocations that will occur. | ||
|
||
If we are only allocating one megabyte or less _strongly_ consider fixed | ||
allocations instead. Fixed allocation help to avoid fragmentation of the heap. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# C++ Style Guide | ||
|
||
|
||
When in double and not in conflict with this document, follow [C++ Core Guidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines) | ||
|
||
## C++ Standards | ||
|
||
Where possible we should use up to C++17. Some external packages, such as PDAL are | ||
limited in what they can use. Where we control the environment we should strive | ||
for C++17 usage. | ||
|
||
## Memory Handling | ||
|
||
See [Memory.md](Memory.md) |