I'm using Objective-C++ for a project. I realize Objective-C++ isn't used that much, but this is for a cross-platform game framework with a common C++ code base, which I think is a valid use case (there are some popular game frameworks that use Objective-C++ for this purpose).
A useful aspect of Swift's fatalError() is that you can submit a formatted string as a message, rather than just a string literal, and this message will appear in the crash log. For example, this:
let x = 1
let y = 2
fatalError("x = \(x), y = \(y)")
Produces this in the crash log:
Fatal error: x = 1, y = 2
assert() is of course available in Objective-C++, but it only allows for string literals as messages, not formatted strings. Both Objective-C and C++ exceptions allow for conveying a formatted message to the crash log, but I'm trying to avoid exceptions (among other things, it might be problematic to propagate exceptions through some of the libraries I'm using). There's also NSAssert() and NSCAssert(), but they use exceptions under the hood.
I could use Swift's fatalError() via a wrapper imported into Objective-C, but just as a matter of cleanliness and convenience I'm wondering if there are any Objective-C(++) options I've overlooked. The goal is to convey a formatted error message to the crash log without using exceptions, which fatalError() allows for, but which there doesn't seem to be an obvious way to do in Objective-C(++). Is there another way to do this that I'm overlooking?