vendredi 25 juin 2021

Incorrectly phrased IF Statement from C++ SDK

I have been using an SDK for Alpaca Markets that was created by another person and released on GitHub. This code contains an IF Statement which does not seem like it is formatted correctly to me, but I am somewhat new to C++. It is pasted below

The if statement does not appear to actually be checking any Boolean values. The code will also fail to compile when this statement is included. The solution I found was to comment it out and set the variables within the config.cpp file.

Is this simply just a mistake?

if (auto e = std::getenv(api_key_id_env_var_.c_str()){
  api_key_id_ = std::str(e);
} else {
  return Status(1, api_key_id_env_var_ + " is not set." 
} 

Aucun commentaire:

Enregistrer un commentaire