Created
July 5, 2023 23:50
-
-
Save drescherjm/1f2b75af770e2e51f4dce515f15cf5f4 to your computer and use it in GitHub Desktop.
Visual Studio command line arguments release problem.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
void run(int planeprev, int cplane, int cplane_id) | |
{ | |
int ninfl = 0; | |
std::cout << "PP=" << planeprev << " CP=" << cplane << " CPID=" << cplane_id << std::endl; | |
if (cplane_id > planeprev && cplane_id < cplane) | |
{ | |
ninfl = 2; | |
} | |
else if (cplane_id < planeprev && cplane_id > cplane) | |
{ | |
ninfl = 2; | |
} | |
else if ((cplane == cplane_id && cplane > planeprev) || | |
(planeprev == cplane_id && cplane < planeprev)) | |
{ | |
ninfl = 1; | |
} | |
else if ((cplane == cplane_id && cplane < planeprev) || | |
(planeprev == cplane_id && cplane > planeprev)) | |
{ | |
ninfl = 1; | |
} | |
if (ninfl != 2) | |
printf("ERROR OUTPUT! \n"); | |
else | |
printf("CORRECT OUTPUT\n"); | |
} | |
#define TEST_BUG | |
int main(int argc, char* argv[]) | |
{ | |
if (argc != 4) | |
{ | |
printf("Call with 2 0 1 as argument"); | |
return 1; | |
} | |
// planeprev=2 cplane=0 cplane_id=1 | |
//int ninfl = 0; | |
#ifdef TEST_BUG | |
int planeprev = std::stoi(argv[1]); | |
int cplane = std::stoi(argv[2]); | |
int cplane_id = std::stoi(argv[3]); | |
#else | |
int planeprev = 2; | |
int cplane = 0; | |
int cplane_id = 1; | |
#endif | |
run(planeprev, cplane, cplane_id); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment