36 ms·
Okay, concretely, I'd like to see a translation of this real-world C++ code (taken from V8): #define RETURN_OBJECT_UNLESS_EXCEPTION(ISOLATE, RETURN_VALUE, RE
by sanxiyn 13y ago
Okay, concretely, I'd like to see a translation of this real-world C++ code (taken from V8):
#define RETURN_OBJECT_UNLESS_EXCEPTION(ISOLATE, RETURN_VALUE, RETURN_EMPTY) \
if (!__allocation__.IsRetry()) { \
__object__ = __allocation__.ToObjectChecked(); \
if (__object__ == (ISOLATE)->heap()->exception()) { RETURN_EMPTY; } \
RETURN_VALUE; \
}
- SupremumLimit 13y agoThis seems to be missing backslashes. I haven't considered how to deal with preprocessor macros, but the if statement converts very simply: if !__allocation__.IsRetry() __object__ = __allocation__.ToObjectChecked() if __object__ == (ISOLATE)->heap()->exception(); RETURN_EMPTY RETURN_VALUE This isn't ambiguous like the example you suggested before.
- sanxiyn 13y agoThat doesn't work, because if statement is inside preprocessor macro and must be in a single line.
- SupremumLimit 13y agoI see what you mean. Yes, the if in a macro is a problem. I haven't addressed macros, that's a whole different can of worms.