Skip to content

Commit d282a96

Browse files
authored
docs: prefer int main(void) to int main() in C examples (#11526)
Functions without any parameter are a pre-ANSI C construct, that is deprecated until C23 and compilers may warn about it. Since C23, main(void) and main() are equivalent (as in C++), but as the standard is quite recent it's better to a-void this old style prototype. Signed-off-by: Antonin Décimo <[email protected]>
1 parent a7e68e3 commit d282a96

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

doc/dune-libs.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Configurator allows you to query for the following features:
2424

2525
* Extract compile time information such as ``#define`` variables.
2626

27-
Configurator is designed to be cross-compilation friendly and avoids _running_
27+
Configurator is designed to be cross-compilation friendly and avoids *running*
2828
any compiled code to extract any of the information above.
2929

3030
Configurator started as an `independent library
@@ -49,7 +49,7 @@ example:
4949
let clock_gettime_code = {|
5050
#include <time.h>
5151
52-
int main()
52+
int main(void)
5353
{
5454
struct timespec ts;
5555
clock_gettime(CLOCK_REALTIME, &ts);

otherlibs/configurator/test/blackbox-tests/configurator.t/c_test/run.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ let () =
55
let c_result =
66
Configurator.c_test t {c|
77
#include <stdio.h>
8-
int main()
8+
int main(void)
99
{
1010
printf("Hello, World!");
1111
return 0;

0 commit comments

Comments
 (0)