From d57566a92359d17365c44edb69c1ad19b140415d Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Wed, 19 Jan 2022 19:11:15 -0500 Subject: [PATCH] Make C code more recognizably C As you may know, an empty parameter list can have [different semantics] in C compared to a `(void)` parameter list. Also, while it's fine to declare `main()` with an empty parameter list, it's implementation defined as to whether it is acceptable. Declare `main` with `(void)` so we use a standard-defined signature from section 5.1.2.2.1 of C99. [different semantics]: https://godbolt.org/z/fW66MsaMM --- src/ffi.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ffi.md b/src/ffi.md index b52a7e99..9e02eee8 100644 --- a/src/ffi.md +++ b/src/ffi.md @@ -281,7 +281,7 @@ We'll create a C file to call the `hello_from_rust` function and compile it by ` C file should look like: ```c -int main() { +int main(void) { hello_from_rust(); return 0; }