From 216d43f700999200a9673129d78bbc2433aa69a5 Mon Sep 17 00:00:00 2001 From: Miloslav Ciz Date: Mon, 7 Feb 2022 15:57:04 +0100 Subject: [PATCH] Update --- c_pitfalls.md | 20 ++++++++++++++++++++ people.md | 1 + ted_kaczynski.md | 3 +++ 3 files changed, 24 insertions(+) create mode 100644 ted_kaczynski.md diff --git a/c_pitfalls.md b/c_pitfalls.md index e37c4f9..f44f02c 100644 --- a/c_pitfalls.md +++ b/c_pitfalls.md @@ -10,6 +10,26 @@ Undefined, unspecified and implementation-defined behaviors are kinds of unpredi **Data type sizes including int and char may not be the same on each platform**. Even though we almost take it for granted than char is 8 bits wide, in theory it can be wider. The int (and unsigned int) type width should reflect the architectures native integer type, so nowadays mostly it's mostly 32 or 64 bits. To deal with this we can use the standard library `limits.h` and `stdint.h` headers. +**Order of evaluation of operands/arguments is not specified**. I.e. in an expression or function call it is not defined which operands or arguments will be evaluated first, the order may be completely random and the order may differ even when evaluating the same expression at another time. This is demonstrated by the following code: + +``` +#include + +int x = 0; + +int a(void) +{ + x += 1; + return x; +} + +int main(void) +{ + printf("%d %d\n",x,a()); // may print 0 1 or 1 1 + return 0; +} +``` + **Char data type signedness is not defined**. The signedness can be explicitly "forced" by specifying `signed char` or `unsigned char`. **Bit shifts by type width or more are undefined.** Also bit shifts by negative values are undefined. So e.g. `x >> 8` is undefined if width of the data type of `x` is 8 bits. diff --git a/people.md b/people.md index 723d2e4..c896af0 100644 --- a/people.md +++ b/people.md @@ -16,5 +16,6 @@ This is a list of notable people in technology. - **[Noam Chomsky](noam_chomsky.md)**: linguist notable in theoretical [compsci](computer_science.md), anarchist - **[Richard Stallman](rmd.md)**: inventor of [free software](free_software.md) and [copyleft](copyleft.md), founder of [GNU](gnu.md) and [FSF](fsf.md), also created [emacs](emacs.md) - **[Steve Jobs](steve_jobs.md)**: founder and CEO of [Apple](apple.md) +- **[Ted Kaczynski](ted_kaczynski.md)**: AKA the Unabomber, mathematician, primitivist and murderer who pointed out the dangers of technology - **[Terry Davis](terry_davis.md)**: schizophrenic genius creator of [Temple OS](temple_os.md), became a tech [meme](meme.md) - **[Uriel](uriel.md)**: deceased member of the [suckless](suckless.md) community, philosophical advisor diff --git a/ted_kaczynski.md b/ted_kaczynski.md new file mode 100644 index 0000000..4f59887 --- /dev/null +++ b/ted_kaczynski.md @@ -0,0 +1,3 @@ +# Ted Kaczynski + +*"The Industrial Revolution and its consequences have been a disaster for the human race."* --Ted Kaczynski \ No newline at end of file