-
Notifications
You must be signed in to change notification settings - Fork 91
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
Generate c++ without exceptions #76
Comments
What should we do instead of |
Some throws are already in FastBinaryEncoding/proto/fbe.cpp Line 85 in f2134da
This one does not get compiled, since neither Unix nor WINxx is defined. So no throw, but also no time? FastBinaryEncoding/proto/fbe.cpp Line 130 in f2134da
This one does get compiled. As far as I can judge, but please correct me if I'm wrong, this one could be eliminated altogether. Instead of writing to _data directly inside the for loop, you could write to a temporary array. Only when the for loop completed successfully, copy the array to _data . This leaves the _data array filled with zeros in case anything goes wrong. Since you already have operator bool() defined, validity can be checked after construction, right?
For the others (asserts + throw), I think the options are
Of course I only have limited knowledge of the code base compared to you, so you might have different ideas. Looking forward to hear what you think. |
As I see in documentation: Is there also any definition for disabled exceptions? Can you check if
|
Just tested, and yes, both #ifdef __cpp_exceptions
#pragma message "__cpp_exceptions is defined"
#else
#pragma message "__cpp_exceptions not defined"
#endif
#ifdef __EXCEPTIONS
#pragma message "__EXCEPTIONS is defined"
#else
#pragma message "__EXCEPTIONS not defined"
#endif Is |
I think to replace |
Sounds good! One other issue I noticed just now, is that the embedded device (compiling with xc32++ v4.10) is neither unix, nor WINxx. That means some code sections / functions are not in compilation at all, since #if defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__)
...
#elif defined(_WIN32) || defined(_WIN64)
...
#endif will be empty in the embedded case. Should I open a new issue for that? |
At several locations in the
fbe.cpp
file exceptions are thrown. Is it possible to generate code without these exceptions?For example here:
FastBinaryEncoding/proto/fbe.cpp
Line 85 in f2134da
I would like to use fbe in an embedded environment, where exceptions are disabled for performance reasons. However, now I am unable to compile the generated c++ code.
The text was updated successfully, but these errors were encountered: