Skip to content

Commit f56acbd

Browse files
committed
ode: make awesome
Start killing some tab devils
1 parent 6c8ab5c commit f56acbd

24 files changed

+458
-405
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,6 @@ callgrind.out*
4444

4545
# perf
4646
perf.data*
47+
48+
# gnuplot inputs generated from executables.
49+
*.dat

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Build Status](https://travis-ci.org/cirosantilli/cpp-cheat.svg?branch=master)](https://travis-ci.org/cirosantilli/cpp-cheat)
44

5-
C and C++ minimal examples. Asserts used wherever possible. Hello worlds for cool third party libraries and build systems. Cheatsheets, tutorials and mini-projects.
5+
C, C++, POSIX / Linux system programming minimal examples. Asserts used wherever possible. Hello worlds for cool third party libraries and build systems. Cheatsheets, tutorials and mini-projects.
66

77
[Assembly Cheat](https://github.com/cirosantilli/assembly-cheat) contains lower level issues, like assembly, ELF and Binutils.
88

c/main_function.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@
5151
#include "common.h"
5252

5353
int main(void) {
54-
return EXIT_SUCCESS;
54+
return EXIT_SUCCESS;
5555
}

c/signal.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -139,38 +139,38 @@ void signal_handler(int sig) {
139139
* In POSIX, we can use write(STDOUT_FILENO, but still there is
140140
* no way to format the string apparently.
141141
*
142-
* - https://stackoverflow.com/questions/16891019/how-to-avoid-using-printf-in-a-signal-handler
143-
* - https://stackoverflow.com/questions/14573000/print-int-from-signal-handler-using-write-or-async-safe-functions
142+
* - https://stackoverflow.com/questions/16891019/how-to-avoid-using-printf-in-a-signal-handler
143+
* - https://stackoverflow.com/questions/14573000/print-int-from-signal-handler-using-write-or-async-safe-functions
144144
* */
145-
/*printf("sig: %d\n", sig);*/
145+
/*printf("sig: %d\n", sig);*/
146146

147-
global = 1;
147+
global = 1;
148148
/* After the signal is dealt with, the handler is then changed to its default action
149149
* if you want to continue using this handler for future signals, you have to reregister. */
150-
signal(sig, signal_handler);
150+
signal(sig, signal_handler);
151151
}
152152

153153
int main(void) {
154154

155155
/* TODO: why don't we handle SIGABRT? */
156156
signal(SIGABRT, signal_handler);
157-
/*abort();*/
157+
/*abort();*/
158158
/*assert(i == 1);*/
159159

160160
#if 0
161161
/* # Floating point exception
162162
*
163163
* TODO why hangs? */
164-
{
165-
signal(SIGFPE, signal_handler);
166-
int i = 0;
167-
int j = 0;
168-
/* cannot do 1 / 0 or the compiler will give a warning. Lets dupe him: */
169-
j = 1 / i;
170-
/* you need this `printf` or the compiler may optimize your division away */
171-
printf("%d", j);
172-
assert(global == 1);
173-
}
164+
{
165+
signal(SIGFPE, signal_handler);
166+
int i = 0;
167+
int j = 0;
168+
/* cannot do 1 / 0 or the compiler will give a warning. Lets dupe him: */
169+
j = 1 / i;
170+
/* you need this `printf` or the compiler may optimize your division away */
171+
printf("%d", j);
172+
assert(global == 1);
173+
}
174174
#endif
175175

176176
/*

cmake/multi_executable/a.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
#include <stdlib.h>
33

44
int main(void) {
5-
puts(__FILE__);
5+
puts(__FILE__);
66
return EXIT_SUCCESS;
77
}

cmake/multi_executable/b.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
#include <stdlib.h>
33

44
int main(void) {
5-
puts(__FILE__);
5+
puts(__FILE__);
66
return EXIT_SUCCESS;
77
}

cmake/multi_file/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
#include "a.h"
55

66
int main(void) {
7-
printf("%d\n", a());
7+
printf("%d\n", a());
88
return EXIT_SUCCESS;
99
}

cmake/multi_file_recursive/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
#include "d/a.h"
55

66
int main(void) {
7-
printf("%d\n", a());
7+
printf("%d\n", a());
88
return EXIT_SUCCESS;
99
}

cpp/common.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class NoBaseNoMember {
158158
}
159159

160160
static void temporaryReferenceConst(const NoBaseNoMember& temp) {
161-
si = temp.i;
161+
si = temp.i;
162162
}
163163
};
164164

0 commit comments

Comments
 (0)