-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error handling merge #41
Conversation
This time focussing mainly on reporting memory allocation errors with exceptions rather than return values.
Conflicts: test/transactions.cpp
Conflicts: src/tightdb/array.cpp src/tightdb/array.hpp src/tightdb/column.cpp src/tightdb/column.hpp src/tightdb/column_binary.hpp src/tightdb/column_mixed.cpp src/tightdb/column_string.hpp src/tightdb/column_tpl.hpp src/tightdb/table_ref.hpp
Conflicts: TightDB.vcxproj.filters
Conflicts: TightDB.vcxproj.filters
This one is ready for your review. |
+1 |
{ | ||
const Table* subtab = t->get_subtable_ptr(column_ndx, row_ndx); | ||
subtab->bind_ref(); | ||
return subtab; | ||
} | ||
|
||
inline Table* LangBindHelper::get_subtable_ptr_during_insert(Table* t, size_t col_ndx, size_t row_ndx) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't just remove this - get_subtable_ptr_during_insert() is used in java-binding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not removed, just moved to cpp-file.
In general, please follow our agreed coding standard wrt. if/else statements: The statements after 'if' or 'else' must be on a seperate line: |
Next phase of error handling.
This time focusing mainly on reporting memory allocation errors with exceptions rather than return values.
Also introducing TIGHTDB_OVERRIDE - (a substitute for C++11 'override')
http://en.wikipedia.org/wiki/C%2B%2B11#Explicit_overrides_and_final
I'm using two kinds of markings to help manage exception safety:
void foo() TIGHTDB_NOEXCEPT - to mark a function that can never throw. Such a function really must never throw, so in general it must not call any function or operator that is not itself marked with TIGHTDB_NOEXCEPT. It requires some care to ensure that this constraint is maintained.
The more functions are marked with TIGHTDB_NOEXCEPT, the easier it will be to ensure that our code behaves appropriately when exceptions are unrolling the call stack.
To indicate where exceptions can emanate from, I use the following notation. I have only added it in places where I am sure the function is really supposed to be allowed to throw.
I am in no way done with this process of exception marking. Two function that I would be particularly interesting in marking non-throwing, are Allocator::Free() and Table::~Table().
/cc @rrrlasse @astigsen @bmunkholm