Will C++ exceptions safely propagate through C code?

前端 未结 5 759
傲寒
傲寒 2020-11-28 11:44

I have a C++ application that calls SQLite\'s (SQLite is in C) sqlite3_exec() which in turn can call my callback function implemented in C++. SQLite is compiled into a stati

5条回答
  •  鱼传尺愫
    2020-11-28 12:16

    There is already a protocol for the callback to abort the API call. From the docs:

    If an sqlite3_exec() callback returns non-zero, the sqlite3_exec() routine returns SQLITE_ABORT without invoking the callback again and without running any subsequent SQL statements.

    I'd strongly recommend you use this instead of an exception.

提交回复
热议问题