, Singleton , . , mpi_glob , Singleton .
- . , const :
const int number_of_tasks = get_preconfigured_number_of_tasks();
, enum . , .
, . , .
, Java? , . Main -, .. ( Java, ).
We can further extend the concept to a Command- like implementation. The difference with regular Java is that your main equivalent of the method is not static, and your global variables with values specific to the contained program are non-stationary member variables. All functions that need access to global state data must be converted to member functions. This is possible because the main function is also a member function.
Thus, I think you can achieve better sealing and data security.
source
share