Skip to content
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

Merged
merged 17 commits into from
Feb 7, 2013
Merged

Error handling merge #41

merged 17 commits into from
Feb 7, 2013

Conversation

kspangsege
Copy link
Contributor

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.

void foo()
{
    alpha();
    beta(); // Throws
    gamma();
}

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

@kspangsege
Copy link
Contributor Author

This one is ready for your review.

@astigsen
Copy link
Contributor

astigsen commented Feb 7, 2013

+1

astigsen pushed a commit that referenced this pull request Feb 7, 2013
@astigsen astigsen merged commit b6cabf3 into realm:master Feb 7, 2013
{
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) {
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@bmunkholm
Copy link
Contributor

In general, please follow our agreed coding standard wrt. if/else statements: The statements after 'if' or 'else' must be on a seperate line:
if (a)
x;
else
y;
Don't change anything now - but just as we go along...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants