Skip to content

Commit

Permalink
use conventional naming of arguments to main() (#769)
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielDoehring authored Jun 4, 2024
1 parent 43a6341 commit a3bff2b
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 30 deletions.
6 changes: 3 additions & 3 deletions contrib/sIPOPT/AmplSolver/ampl_sipopt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include "SensRegOp.hpp"

int main(
int /*argv*/,
char** argc
int /*argc*/,
char** argv
)
{
using namespace Ipopt;
Expand Down Expand Up @@ -123,7 +123,7 @@ int main(
"Number of sensitivity steps");

// create AmplSensTNLP from argc.
SmartPtr<TNLP> sens_tnlp = new SensAmplTNLP(ConstPtr(app_ipopt->Jnlst()), app_ipopt->RegOptions(), app_ipopt->Options(), argc, suffix_handler,
SmartPtr<TNLP> sens_tnlp = new SensAmplTNLP(ConstPtr(app_ipopt->Jnlst()), app_ipopt->RegOptions(), app_ipopt->Options(), argv, suffix_handler,
false, ampl_options_list);

app_sens->Initialize();
Expand Down
4 changes: 2 additions & 2 deletions contrib/sIPOPT/examples/parametric_cpp/parametric_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include "SensRegOp.hpp"

int main(
int /*argv*/,
char** /*argc*/
int /*argc*/,
char** /*argv*/
)
{
using namespace Ipopt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include "SensRegOp.hpp"

int main(
int /*argv*/,
char** /*argc*/
int /*argc*/,
char** /*argv*/
)
{
using namespace Ipopt;
Expand Down
4 changes: 2 additions & 2 deletions contrib/sIPOPT/examples/redhess_cpp/redhess_cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include "SensRegOp.hpp"

int main(
int /*argv*/,
char** /*argc*/
int /*argc*/,
char** /*argv*/
)
{

Expand Down
26 changes: 13 additions & 13 deletions examples/ScalableProblems/solve_problem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,49 +97,49 @@ static void print_problems()
}

int main(
int argv,
char* argc[]
int argc,
char* argv[]
)
{
if( argv == 2 && !strcmp(argc[1], "list") )
if( argc == 2 && !strcmp(argv[1], "list") )
{
print_problems();
return 0;
}

#ifdef TIME_LIMIT
int runtime;
if( argv == 4 )
if( argc == 4 )
{
runtime = atoi(argc[3]);
runtime = atoi(argv[3]);
}
else
#endif
if( argv != 3 && argv != 1 )
if( argc != 3 && argc != 1 )
{
printf("Usage: %s (this will ask for problem name)\n", argc[0]);
printf(" %s ProblemName N\n", argc[0]);
printf("Usage: %s (this will ask for problem name)\n", argv[0]);
printf(" %s ProblemName N\n", argv[0]);
printf(" where N is a positive parameter determining problem size\n");
printf(" %s list\n", argc[0]);
printf(" %s list\n", argv[0]);
printf(" to list all registered problems.\n");
return -1;
}

SmartPtr<RegisteredTNLP> tnlp;
Index N;

if( argv != 1 )
if( argc != 1 )
{
// Create an instance of your nlp...
tnlp = RegisteredTNLPs::GetTNLP(argc[1]);
tnlp = RegisteredTNLPs::GetTNLP(argv[1]);
if( !IsValid(tnlp) )
{
printf("Problem with name \"%s\" not known.\n", argc[1]);
printf("Problem with name \"%s\" not known.\n", argv[1]);
print_problems();
return -2;
}

N = atoi(argc[2]);
N = atoi(argv[2]);
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions examples/hs071_cpp/hs071_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
using namespace Ipopt;

int main(
int /*argv*/,
char** /*argc*/
int /*argc*/,
char** /*argv*/
)
{
// Create a new instance of your nlp
Expand Down
4 changes: 2 additions & 2 deletions tutorial/CodingExercise/Cpp/1-skeleton/TutorialCpp_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
using namespace Ipopt;

int main(
int argv,
char* argc[]
int /*argc*/,
char* /*argv[]*/
)
{
// Set the data:
Expand Down
4 changes: 2 additions & 2 deletions tutorial/CodingExercise/Cpp/2-mistake/TutorialCpp_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
using namespace Ipopt;

int main(
int argv,
char* argc[]
int /*argc*/,
char** /*argc*/
)
{
// Set the data:
Expand Down
4 changes: 2 additions & 2 deletions tutorial/CodingExercise/Cpp/3-solution/TutorialCpp_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
using namespace Ipopt;

int main(
int argv,
char* argc[]
int /*argc*/,
char** /*argv*/
)
{
// Set the data:
Expand Down

0 comments on commit a3bff2b

Please sign in to comment.