Sep. 16th, 2019

c wtf

Sep. 16th, 2019 11:13 am
juan_gandhi: (Default)

Reading this book: https://www.oreilly.com/library/view/programming-rust/9781491927274/ch01.html

It says:
 

Consider the following C program:

int main(int argc, char **argv) {
  unsigned long a[1];
  a[3] = 0x7ffff7b36cebUL;
  return 0;
}

According to C99, because this program accesses an element off the end of the array a, its behavior is undefined, meaning that it can do anything whatsoever. When we ran this program on Jim’s laptop, it produced the following output:

undef: Error: .netrc file is readable by others.
undef: Remove password or make file unreadable by others.

Then it crashed. Jim’s laptop doesn’t even have a .netrc file. If you try it yourself, it will probably do something entirely different. 

juan_gandhi: (Default)
 Вылечились уже? Вот мне как-то не на 100% верится. На 80%, может быть. Но не на 100%

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

September 2025

S M T W T F S
 1 2345 6
78 9 10 111213
14151617181920
21222324252627
282930    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 12th, 2025 12:22 am
Powered by Dreamwidth Studios