Skip to content

Commit a3bff2b

Browse files
use conventional naming of arguments to main() (#769)
1 parent 43a6341 commit a3bff2b

File tree

9 files changed

+30
-30
lines changed

9 files changed

+30
-30
lines changed

contrib/sIPOPT/AmplSolver/ampl_sipopt.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
#include "SensRegOp.hpp"
1313

1414
int main(
15-
int /*argv*/,
16-
char** argc
15+
int /*argc*/,
16+
char** argv
1717
)
1818
{
1919
using namespace Ipopt;
@@ -123,7 +123,7 @@ int main(
123123
"Number of sensitivity steps");
124124

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

129129
app_sens->Initialize();

contrib/sIPOPT/examples/parametric_cpp/parametric_driver.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
#include "SensRegOp.hpp"
1313

1414
int main(
15-
int /*argv*/,
16-
char** /*argc*/
15+
int /*argc*/,
16+
char** /*argv*/
1717
)
1818
{
1919
using namespace Ipopt;

contrib/sIPOPT/examples/parametric_dsdp_cpp/parametric_dsdp_driver.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
#include "SensRegOp.hpp"
1313

1414
int main(
15-
int /*argv*/,
16-
char** /*argc*/
15+
int /*argc*/,
16+
char** /*argv*/
1717
)
1818
{
1919
using namespace Ipopt;

contrib/sIPOPT/examples/redhess_cpp/redhess_cpp.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
#include "SensRegOp.hpp"
1313

1414
int main(
15-
int /*argv*/,
16-
char** /*argc*/
15+
int /*argc*/,
16+
char** /*argv*/
1717
)
1818
{
1919

examples/ScalableProblems/solve_problem.cpp

+13-13
Original file line numberDiff line numberDiff line change
@@ -97,49 +97,49 @@ static void print_problems()
9797
}
9898

9999
int main(
100-
int argv,
101-
char* argc[]
100+
int argc,
101+
char* argv[]
102102
)
103103
{
104-
if( argv == 2 && !strcmp(argc[1], "list") )
104+
if( argc == 2 && !strcmp(argv[1], "list") )
105105
{
106106
print_problems();
107107
return 0;
108108
}
109109

110110
#ifdef TIME_LIMIT
111111
int runtime;
112-
if( argv == 4 )
112+
if( argc == 4 )
113113
{
114-
runtime = atoi(argc[3]);
114+
runtime = atoi(argv[3]);
115115
}
116116
else
117117
#endif
118-
if( argv != 3 && argv != 1 )
118+
if( argc != 3 && argc != 1 )
119119
{
120-
printf("Usage: %s (this will ask for problem name)\n", argc[0]);
121-
printf(" %s ProblemName N\n", argc[0]);
120+
printf("Usage: %s (this will ask for problem name)\n", argv[0]);
121+
printf(" %s ProblemName N\n", argv[0]);
122122
printf(" where N is a positive parameter determining problem size\n");
123-
printf(" %s list\n", argc[0]);
123+
printf(" %s list\n", argv[0]);
124124
printf(" to list all registered problems.\n");
125125
return -1;
126126
}
127127

128128
SmartPtr<RegisteredTNLP> tnlp;
129129
Index N;
130130

131-
if( argv != 1 )
131+
if( argc != 1 )
132132
{
133133
// Create an instance of your nlp...
134-
tnlp = RegisteredTNLPs::GetTNLP(argc[1]);
134+
tnlp = RegisteredTNLPs::GetTNLP(argv[1]);
135135
if( !IsValid(tnlp) )
136136
{
137-
printf("Problem with name \"%s\" not known.\n", argc[1]);
137+
printf("Problem with name \"%s\" not known.\n", argv[1]);
138138
print_problems();
139139
return -2;
140140
}
141141

142-
N = atoi(argc[2]);
142+
N = atoi(argv[2]);
143143
}
144144
else
145145
{

examples/hs071_cpp/hs071_main.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
using namespace Ipopt;
1414

1515
int main(
16-
int /*argv*/,
17-
char** /*argc*/
16+
int /*argc*/,
17+
char** /*argv*/
1818
)
1919
{
2020
// Create a new instance of your nlp

tutorial/CodingExercise/Cpp/1-skeleton/TutorialCpp_main.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
using namespace Ipopt;
2929

3030
int main(
31-
int argv,
32-
char* argc[]
31+
int /*argc*/,
32+
char* /*argv[]*/
3333
)
3434
{
3535
// Set the data:

tutorial/CodingExercise/Cpp/2-mistake/TutorialCpp_main.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
using namespace Ipopt;
3030

3131
int main(
32-
int argv,
33-
char* argc[]
32+
int /*argc*/,
33+
char** /*argc*/
3434
)
3535
{
3636
// Set the data:

tutorial/CodingExercise/Cpp/3-solution/TutorialCpp_main.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
using namespace Ipopt;
3232

3333
int main(
34-
int argv,
35-
char* argc[]
34+
int /*argc*/,
35+
char** /*argv*/
3636
)
3737
{
3838
// Set the data:

0 commit comments

Comments
 (0)