Skip to content

Commit 7d33a04

Browse files
committed
add void to no-parm function declrs
1 parent f279584 commit 7d33a04

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

ch01_01_unit_test/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Repository: https://github.com/capnramses/pro_programming_tools_c_cpp
99
/* trivial function to add two integers */
1010
int my_adder( int a, int b ) { return a + b; }
1111

12-
void run_tests() {
12+
void run_tests( void ) {
1313
int a_inputs[3] = { 0, 100, -100 };
1414
int b_inputs[3] = { 0, -200, 200 };
1515
int expected_outputs[3] = { 0, -100, 100 };

ch04_00_deliberate_crash/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ Getting the list of strings in the stack trace requires system-specific calls.
4444

4545
int* ptr = NULL;
4646

47-
void function_that_crashed() {
47+
void function_that_crashed( void ) {
4848
int value = *ptr; // should crash here. dereferencing a null pointer.
4949
printf( "value %i\n", value );
5050
}
5151

52-
void some_intermediate_function() { function_that_crashed(); }
52+
void some_intermediate_function( void ) { function_that_crashed(); }
5353

5454
int main( void ) {
5555
some_intermediate_function();

ch05_00_gprof/main.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@ To tabulate profiling results after running:
1515

1616
#include <stdio.h>
1717

18-
void great_greatchild() {
18+
void great_greatchild( void ) {
1919
for ( int i = 0; i < 0x10000000; i++ ) { ; }
2020
}
2121

22-
void grandchild() {
22+
void grandchild( void ) {
2323
for ( int i = 0; i < 0x1000000; i++ ) { ; }
2424
great_greatchild();
2525
}
2626

27-
void child() {
27+
void child( void ) {
2828
for ( int i = 0; i < 0x100000; i++ ) { ; }
2929
grandchild();
3030
}
3131

32-
void parent() {
32+
void parent( void ) {
3333
for ( int i = 0; i < 0x1000; i++ ) { ; }
3434
child();
3535
}

0 commit comments

Comments
 (0)