There is value in a simple integer error code return from public C APIs, but it would be nice to have an easy way to get the full statement that forced the return, assert-style. INVALID_VALUE is not as helpful as it could be.
-
-
Replying to @ID_AA_Carmack
In the stuff I am working on there is a context-global logging function that anyone can call, defined by the application, can be disabled in release builds etc. It is very easy to just write log_error("Not enough foobazzes in the fiblinx"), much more annoying to have to build out
6 replies 0 retweets 52 likes -
Replying to @Jonathan_Blow @ID_AA_Carmack
some structure where there is a string for every error code, a function that maps one to the other or whatever, for every little thing that can go wrong. (This of course leads to the thing that happened on both Unix and Windows where the same set of error codes gets mashed
1 reply 0 retweets 17 likes -
Replying to @Jonathan_Blow @ID_AA_Carmack
together for everything, leading e.g. to everyone's favorite useless error EINVAL.) I think the improved ergonomics of just observing how bad this all went, and setting up the incentives so that better things happen naturally, are huge (and underestimated by everyone).
2 replies 0 retweets 21 likes -
Replying to @Jonathan_Blow @ID_AA_Carmack
(The important thing about this logging function being that it is an established convention that leaf-functionality library authors can use and they just expect the application to do what it wants with it, they don't have to build their own reporting system for each lib, etc).
1 reply 0 retweets 20 likes -
Replying to @Jonathan_Blow @ID_AA_Carmack
1) log_error() only takes in a string, not an arbitrary type right? 2) By "turning it off" in release mode, do you define it to do nothing and let the optimizer handle that? Or is there some # command?
1 reply 0 retweets 1 like -
Replying to @dbokser91 @ID_AA_Carmack
A string and some optionally-provided flags and extra information. You could either have your log callback be empty, or define out the calls to log assert-style.
1 reply 0 retweets 8 likes
(It really depends on what is being logged. Like, you might want to maintain a debugger breakpoint in the logging function for errors, even if you aren't doing anything with the output, as a sanity check).
-
-
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.