Skip to content

Instantly share code, notes, and snippets.

@mikebaldry
Created December 25, 2011 12:26
Show Gist options
  • Select an option

  • Save mikebaldry/1519173 to your computer and use it in GitHub Desktop.

Select an option

Save mikebaldry/1519173 to your computer and use it in GitHub Desktop.
Why would resulting_command need to be declared, when declaring it?
command_parser.cpp:13: error: ‘resulting_command’ was not declared in this scope..
command& command_parser::parse(const std::string& command) {
13: command* resulting_command = NULL;
std::vector<std::string> parts;
boost::split(parts, command, boost::is_any_of(" "));
std::string cmd = parts.at(0);
boost::to_upper(cmd);
parts.erase(parts.begin());
if (cmd == "AUTH") {
resulting_command = new auth_command();
}
if (resulting_command != NULL) {
resulting_command.initialize(parts);
}
return &resulting_command;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment