Skip to content

style: remove unused params of main #2948

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,9 @@ static void test() {

/**
* @brief Main function
* @param argc commandline argument count (ignored)
* @param argv commandline array of arguments (ignored)
* @returns 0 on exit
*/
int main(int argc, char *argv[]) {
int main() {
test(); // run self-test implementations
// code here
return 0;
Expand Down
4 changes: 1 addition & 3 deletions data_structures/sparse_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,9 @@ static void test() {

/**
* @brief Main function
* @param argc commandline argument count (ignored)
* @param argv commandline array of arguments (ignored)
* @returns 0 on exit
*/
int main(int argc, char *argv[]) {
int main() {
test(); // run self-test implementations
return 0;
}
4 changes: 2 additions & 2 deletions data_structures/tree_234.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1291,8 +1291,8 @@ static void test2(int64_t n) {

/**
* @brief Main function
* @param argc commandline argument count (ignored)
* @param argv commandline array of arguments (ignored)
* @param argc commandline argument count
* @param argv commandline array of arguments
* @returns 0 on exit
*/
int main(int argc, char *argv[]) {
Expand Down
2 changes: 1 addition & 1 deletion dynamic_programming/fibonacci_bottom_up.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ int fib(int n) {
}
return res[1];
}
int main(int argc, char const *argv[]) {
int main() {
int n;
cout << "Enter n: ";
cin >> n;
Expand Down
4 changes: 1 addition & 3 deletions dynamic_programming/longest_increasing_subsequence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,9 @@ static void test() {

/**
* @brief Main function
* @param argc commandline argument count (ignored)
* @param argv commandline array of arguments (ignored)
* @returns 0 on exit
*/
int main(int argc, char const *argv[]) {
int main() {
uint32_t n = 0;

std::cout << "Enter size of array: ";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ int LIS(const std::vector<int>& arr, int n) {
}
return active.size(); // size of the LIS.
}
int main(int argc, char const* argv[]) {
int main() {
int n;
cout << "Enter size of array: ";
cin >> n;
Expand Down
4 changes: 1 addition & 3 deletions dynamic_programming/maximum_circular_subarray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,9 @@ static void test() {

/**
* @brief Main function
* @param argc commandline argument count (ignored)
* @param argv commandline array of arguments (ignored)
* @returns 0 on exit
*/
int main(int argc, char *argv[]) {
int main() {
test(); // run self-test implementations
return 0;
}
4 changes: 1 addition & 3 deletions dynamic_programming/minimum_edit_distance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,9 @@ static void test() {

/**
* @brief main function
* @param argc commandline argument count (ignored)
* @param argv commandline array of arguments (ignored)
* @returns 0 on exit
*/
int main(int argc, char *argv[]) {
int main() {
test(); // run self-test implementations
return 0;
}
4 changes: 1 addition & 3 deletions graph/hamiltons_cycle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,8 @@ static void test3() {
/**
* Main function
*
* @param argc commandline argument count (ignored)
* @param argv commandline array of arguments (ignored)
*/
int main(int argc, char **argv) {
int main() {
test1();
test2();
test3();
Expand Down
4 changes: 1 addition & 3 deletions machine_learning/k_nearest_neighbors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,9 @@ static void test() {

/**
* @brief Main function
* @param argc commandline argument count (ignored)
* @param argv commandline array of arguments (ignored)
* @return int 0 on exit
*/
int main(int argc, char* argv[]) {
int main() {
test(); // run self-test implementations
return 0;
}
2 changes: 1 addition & 1 deletion machine_learning/kohonen_som_topology.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ double get_clock_diff(clock_t start_t, clock_t end_t) {
}

/** Main function */
int main(int argc, char **argv) {
int main() {
#ifdef _OPENMP
std::cout << "Using OpenMP based parallelization\n";
#else
Expand Down
2 changes: 1 addition & 1 deletion machine_learning/kohonen_som_trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ double get_clock_diff(clock_t start_t, clock_t end_t) {
}

/** Main function */
int main(int argc, char **argv) {
int main() {
#ifdef _OPENMP
std::cout << "Using OpenMP based parallelization\n";
#else
Expand Down
4 changes: 1 addition & 3 deletions math/eulers_totient_function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,9 @@ static void test() {

/**
* @brief Main function
* @param argc commandline argument count (ignored)
* @param argv commandline array of arguments (ignored)
* @returns 0 on exit
*/
int main(int argc, char *argv[]) {
int main() {
test();
return 0;
}
4 changes: 1 addition & 3 deletions math/modular_division.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,9 @@ static void test() {

/**
* @brief Main function
* @param argc commandline argument count (ignored)
* @param argv commandline array of arguments (ignored)
* @returns 0 on exit
*/
int main(int argc, char *argv[]) {
int main() {
test(); // execute the tests
return 0;
}
4 changes: 1 addition & 3 deletions math/n_choose_r.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,9 @@ static void test() {

/**
* @brief Main function
* @param argc commandline argument count (ignored)
* @param argv commandline array of arguments (ignored)
* @returns 0 on exit
*/
int main(int argc, char *argv[]) {
int main() {
test(); // executing tests
return 0;
}
2 changes: 1 addition & 1 deletion math/realtime_stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void test_function(const float *test_data, const int number_of_samples) {
}

/** Main function */
int main(int argc, char **argv) {
int main() {
const float test_data1[] = {3, 4, 5, -1.4, -3.6, 1.9, 1.};
test_function(test_data1, sizeof(test_data1) / sizeof(test_data1[0]));

Expand Down
4 changes: 1 addition & 3 deletions numerical_methods/babylonian_method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,11 @@ static void test() {

/**
* @brief Main function
* @param argc commandline argument count (ignored)
* @param argv commandline array of arguments (ignored)
* calls automated test function to test the working of fast fourier transform.
* @returns 0 on exit
*/

int main(int argc, char const *argv[]) {
int main() {
test(); // run self-test implementations
// with 2 defined test cases
return 0;
Expand Down
4 changes: 2 additions & 2 deletions numerical_methods/composite_simpson_rule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ static void test(std::int32_t N, double h, double a, double b,

/**
* @brief Main function
* @param argc commandline argument count (ignored)
* @param argv commandline array of arguments (ignored)
* @param argc commandline argument count
* @param argv commandline array of arguments
* @returns 0 on exit
*/
int main(int argc, char** argv) {
Expand Down
4 changes: 1 addition & 3 deletions numerical_methods/fast_fourier_transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,11 @@ static void test() {

/**
* @brief Main function
* @param argc commandline argument count (ignored)
* @param argv commandline array of arguments (ignored)
* calls automated test function to test the working of fast fourier transform.
* @returns 0 on exit
*/

int main(int argc, char const *argv[]) {
int main() {
test(); // run self-test implementations
// with 2 defined test cases
return 0;
Expand Down
4 changes: 1 addition & 3 deletions numerical_methods/inverse_fast_fourier_transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,11 @@ static void test() {

/**
* @brief Main function
* @param argc commandline argument count (ignored)
* @param argv commandline array of arguments (ignored)
* calls automated test function to test the working of fast fourier transform.
* @returns 0 on exit
*/

int main(int argc, char const *argv[]) {
int main() {
test(); // run self-test implementations
// with 2 defined test cases
return 0;
Expand Down
2 changes: 1 addition & 1 deletion numerical_methods/lu_decompose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void test2() {
}

/** Main function */
int main(int argc, char **argv) {
int main() {
std::srand(std::time(NULL)); // random number initializer

test1();
Expand Down
4 changes: 2 additions & 2 deletions numerical_methods/midpoint_integral_method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ static void test(std::int32_t N, double h, double a, double b,

/**
* @brief Main function
* @param argc commandline argument count (ignored)
* @param argv commandline array of arguments (ignored)
* @param argc commandline argument count
* @param argv commandline array of arguments
* @returns 0 on exit
*/
int main(int argc, char** argv) {
Expand Down
4 changes: 1 addition & 3 deletions operations_on_datastructures/inorder_successor_of_bst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,11 +391,9 @@ static void test() {

/**
* @brief Main function
* @param argc commandline argument count (ignored)
* @param argv commandline array of arguments (ignored)
* @returns 0 on exit
*/
int main(int argc, char *argv[]) {
int main() {
test(); // run self-test implementations

operations_on_datastructures::inorder_traversal_of_bst::Node *root =
Expand Down
4 changes: 1 addition & 3 deletions operations_on_datastructures/trie_multiple_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,11 +459,9 @@ static void test() {

/**
* @brief Main function
* @param argc commandline argument count (ignored)
* @param argv commandline array of arguments (ignored)
* @returns 0 on exit
*/
int main(int argc, char const *argv[]) {
int main() {
test(); // run self-test implementations
return 0;
}
4 changes: 1 addition & 3 deletions probability/windowed_median.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,9 @@ static void test(const std::vector<int> &vals, int windowSize) {

/**
* @brief Main function
* @param argc command line argument count (ignored)
* @param argv command line array of arguments (ignored)
* @returns 0 on exit
*/
int main(int argc, const char *argv[]) {
int main() {
/// A few fixed test cases
test({1, 2, 3, 4, 5, 6, 7, 8, 9},
3); /// Array of sorted values; odd window size
Expand Down
4 changes: 1 addition & 3 deletions search/sublist_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,9 @@ static void test() {

/**
* @brief Main function
* @param argc commandline argument count (ignored)
* @param argv commandline array of arguments (ignored)
* @returns 0 on exit
*/
int main(int argc, char *argv[]) {
int main() {
test(); // run self-test implementations

std::vector<uint64_t> mainlistData = {
Expand Down
2 changes: 1 addition & 1 deletion sorting/non_recursive_merge_sort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void non_recursive_merge_sort(const Iterator first, const Iterator last) {

using sorting::non_recursive_merge_sort;

int main(int argc, char** argv) {
int main() {
int size;
std::cout << "Enter the number of elements : ";
std::cin >> size;
Expand Down
2 changes: 1 addition & 1 deletion sorting/radix_sort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void print(int a[], int n) {
std::cout << std::endl;
}

int main(int argc, char const* argv[]) {
int main() {
int a[] = {170, 45, 75, 90, 802, 24, 2, 66};
int n = sizeof(a) / sizeof(a[0]);
radixsort(a, n);
Expand Down
4 changes: 1 addition & 3 deletions sorting/random_pivot_quick_sort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,9 @@ static void test() {

/**
* @brief Main function
* @param argc commandline argument count (ignored)
* @param argv commandline array of arguments (ignored)
* @returns 0 on exit
*/
int main(int argc, char *argv[]) {
int main() {
test(); // Executes various test cases.

const int64_t inputSize = 10;
Expand Down
2 changes: 0 additions & 2 deletions sorting/stooge_sort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ void test3() {

/**
* @brief Main function
* @param argc commandline argument count (ignored)
* @param argv commandline array of arguments (ignored)
* @returns 0 on exit
*/
int main() {
Expand Down
Loading