You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2017/07/31 22:55:47 UTC
arrow git commit: ARROW-187: [C++] Add development style notes to C++
README, note about esoteric exceptions in constructors
Repository: arrow
Updated Branches:
refs/heads/master af2aeafca -> 900105ac2
ARROW-187: [C++] Add development style notes to C++ README, note about esoteric exceptions in constructors
Author: Wes McKinney <we...@twosigma.com>
Closes #917 from wesm/ARROW-187 and squashes the following commits:
8424e968 [Wes McKinney] Typo
0bee93cd [Wes McKinney] Add development style notes to C++ README, note about esoteric exceptions
Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/900105ac
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/900105ac
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/900105ac
Branch: refs/heads/master
Commit: 900105ac2e096c4dc24f1b95142bf40c383bed82
Parents: af2aeaf
Author: Wes McKinney <we...@twosigma.com>
Authored: Mon Jul 31 18:55:43 2017 -0400
Committer: Wes McKinney <we...@twosigma.com>
Committed: Mon Jul 31 18:55:43 2017 -0400
----------------------------------------------------------------------
cpp/README.md | 35 ++++++++++++++++++++++++++++++++---
1 file changed, 32 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/arrow/blob/900105ac/cpp/README.md
----------------------------------------------------------------------
diff --git a/cpp/README.md b/cpp/README.md
index 05a8ba4..6b16589 100644
--- a/cpp/README.md
+++ b/cpp/README.md
@@ -107,6 +107,35 @@ directoy:
This requires [Doxygen](http://www.doxygen.org) to be installed.
+## Development
+
+This project follows [Google's C++ Style Guide][3] with minor exceptions. We do
+not encourage anonymous namespaces and we relax the line length restriction to
+90 characters.
+
+### Error Handling and Exceptions
+
+For error handling, we use `arrow::Status` values instead of throwing C++
+exceptions. Since the Arrow C++ libraries are intended to be useful as a
+component in larger C++ projects, using `Status` objects can help with good
+code hygiene by making explicit when a function is expected to be able to fail.
+
+For expressing invariants and "cannot fail" errors, we use DCHECK macros
+defined in `arrow/util/logging.h`. These checks are disabled in release builds
+and are intended to catch internal development errors, particularly when
+refactoring. These macros are not to be included in any public header files.
+
+Since we do not use exceptions, we avoid doing expensive work in object
+constructors. Objects that are expensive to construct may often have private
+constructors, with public static factory methods that return `Status`.
+
+There are a number of object constructors, like `arrow::Schema` and
+`arrow::RecordBatch` where larger STL container objects like `std::vector` may
+be created. While it is possible for `std::bad_alloc` to be thrown in these
+constructors, the circumstances where they would are somewhat esoteric, and it
+is likely that an application would have encountered other more serious
+problems prior to having `std::bad_alloc` thrown in a constructor.
+
## Continuous Integration
Pull requests are run through travis-ci for continuous integration. You can avoid
@@ -114,9 +143,8 @@ build failures by running the following checks before submitting your pull reque
make unittest
make lint
- # The next two commands may change your code. It is recommended you commit
- # before running them.
- make clang-tidy # requires clang-tidy is installed
+ # The next command may change your code. It is recommended you commit
+ # before running it.
make format # requires clang-format is installed
Note that the clang-tidy target may take a while to run. You might consider
@@ -132,3 +160,4 @@ both of these options would be used rarely. Current known uses-cases whent hey
[1]: https://brew.sh/
[2]: https://github.com/apache/arrow/blob/master/cpp/apidoc/Windows.md
+[3]: https://google.github.io/styleguide/cppguide.html
\ No newline at end of file