mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 17:38:16 +03:00
Explicitly declare void for all void parameter functions (#628)
Apparently in C, if you have `void test();`, it's completely okay to do `test(2);`. The function will take in the argument, but just discard it and throw it away. It's like a trash can, and a rude one at that. If you declare it like `void test(void);`, this is prevented. This is not a problem in C++ - doing `void test();` and `test(2);` is guaranteed to result in a compile error (this also means that right now, at least in all `.cpp` files, nobody is ever calling a void parameter function with arguments and having their arguments be thrown away). However, we may not be using C++ in the future, so I just want to lay down the precedent that if a function takes in no arguments, you must explicitly declare it as such. I would've added `-Wstrict-prototypes`, but it produces an annoying warning message saying it doesn't work in C++ mode if you're compiling in C++ mode. So it can be added later.
This commit is contained in:
@@ -173,7 +173,7 @@ static void updatebuttonmappings(int bind)
|
||||
}
|
||||
}
|
||||
|
||||
static void menuactionpress()
|
||||
static void menuactionpress(void)
|
||||
{
|
||||
switch (game.currentmenuname)
|
||||
{
|
||||
@@ -1607,7 +1607,7 @@ static void menuactionpress()
|
||||
}
|
||||
}
|
||||
|
||||
void titleinput()
|
||||
void titleinput(void)
|
||||
{
|
||||
//game.mx = (mouseX / 4);
|
||||
//game.my = (mouseY / 4);
|
||||
@@ -1706,7 +1706,7 @@ void titleinput()
|
||||
script.startgamemode(game.mainmenu);
|
||||
}
|
||||
|
||||
void gameinput()
|
||||
void gameinput(void)
|
||||
{
|
||||
//TODO mouse input
|
||||
//game.mx = (mouseX / 2);
|
||||
@@ -2059,9 +2059,9 @@ void gameinput()
|
||||
}
|
||||
}
|
||||
|
||||
static void mapmenuactionpress();
|
||||
static void mapmenuactionpress(void);
|
||||
|
||||
void mapinput()
|
||||
void mapinput(void)
|
||||
{
|
||||
//TODO Mouse Input!
|
||||
//game.mx = (mouseX / 2);
|
||||
@@ -2248,7 +2248,7 @@ void mapinput()
|
||||
}
|
||||
}
|
||||
|
||||
static void mapmenuactionpress()
|
||||
static void mapmenuactionpress(void)
|
||||
{
|
||||
switch (game.menupage)
|
||||
{
|
||||
@@ -2380,7 +2380,7 @@ static void mapmenuactionpress()
|
||||
}
|
||||
}
|
||||
|
||||
void teleporterinput()
|
||||
void teleporterinput(void)
|
||||
{
|
||||
//Todo Mouseinput!
|
||||
//game.mx = (mouseX / 2);
|
||||
@@ -2513,7 +2513,7 @@ void teleporterinput()
|
||||
}
|
||||
}
|
||||
|
||||
void gamecompleteinput()
|
||||
void gamecompleteinput(void)
|
||||
{
|
||||
game.press_left = false;
|
||||
game.press_right = false;
|
||||
@@ -2562,7 +2562,7 @@ void gamecompleteinput()
|
||||
}
|
||||
}
|
||||
|
||||
void gamecompleteinput2()
|
||||
void gamecompleteinput2(void)
|
||||
{
|
||||
game.press_left = false;
|
||||
game.press_right = false;
|
||||
|
||||
Reference in New Issue
Block a user