Thursday, 22 August 2013

Paramater validation c++

Paramater validation c++

I've been thinking of a solution to validate the set of parameters a
function/mehod receives using an object oriented approach. For example, in
the following snippet the parameters are checked "manually" before being
used.
InstallData::InstallData(std::string appPath, std::string appName,
std::string errMsg) {
if(appPath.empty()) {
#ifndef NDEBUG
std::cout << "Path not specified" << std::endl;

No comments:

Post a Comment