-
Notifications
You must be signed in to change notification settings - Fork 131
Description
Idea:
I think it would be useful to provide uniform way to handle unimplemented code. Especially with efforts porting for different platforms/architectures (64bit?)/compilers (where alternative code needs to be written).
Scenario: when porting, there can be some piece of code or function, maybe not so critical (but maybe hard to port), and one could be tempted to just do:
void notSoImportantFunction() {
#ifdef _MSC_VER
// e.g. some MSC specifc code here ( maybe difficult to port)
// ....
#endif
}("for time being, to make things compile, to be implemented later")
However such code can produce problems later, if forgotten. Causing hard to debug problems and missbehaviors.
I was thinking maybe there could be some uniform way, how to handle such cases. Maybe macro such as:
void notSoImportantFunction() {
#ifdef _MSC_VER
// e.g. some MSC specifc code here ( maybe difficult to port)
// ....
#else
UNIMPLEMENTED_ERROR("message") // to be implemented later
#endif
}This macro should produce (fatal) runtime error when reached. Possibly (?) also generating warning on compile time. It should be easy to use (so no reason to avoid it, maybe even automatically provided by headers like BaseType.h or always.h). It should also be easily searchable.
Porting (alternative implementations) could then start with parts of code unimplemented (i.e. just to make things compile) and then gradually implementing missing pieces, without danger of silently broken code.