interface - C++ compile-time un-implmented check -
we have several c++ functions implemented in phase 2 of our project part of public interface or respective classes , modules. because part of public interface, think should present, @ least in headers, during phase 1 still thinking them implement rest of classes. however, since unimplemented, want no 1 call them. check occur @ compile time, ensure correctness.
my desires are:
compile time (could error or warning; warnings better because more flexible - can selectively turn them off)
works on g++4.8.1 , doesn't kill build under visual studio 2013 (we use visual studio/visualassistx editor refactoring tools don't work without building)
not hard understand done , why
functions present in class documentation (we can include
\warning not implemented in phase 1
notation doxygen pick up)
i considering 3 options:
a belt , suspenders approach of marking them deprecated (which generate warning) , throwing custom exception - want except compiler warning "deprecated" opposite of real situation: deprecated method works won't work later; method work later not work now
another answer tells how forbid using function while still having exist - unreadable , hard search for. plus, compile-time error - can't let functions call if change our minds - or nothing. , making every unimplemented function template makes me wonder if trick work. example, virtual functions can't templates.
just putting them in comment - keeps people calling them, don't show in auto-generated documentation (and can't decide later have selective calling)
is there better way? , if not there reason prefer template or comment options on deprecated option?
as alternative:
you can declare them without definition, link error.
may provide library not_yet_implemented
empty definition allow premature usage of these functions.
or
mark method deleted: = delete
, wrapping in macro
#define not_yet_implemented = delete
Comments
Post a Comment