joosteto's comments

joosteto | 7 years ago | on: iPhones are allergic to helium

Sugar in coke doesn't sink to the bottom, indeed, but if you put a sugar cube in water, it first sinks to the bottom, and then (slowly) dissolves.

Likewise, if you release helium in air, it goes up first, and then (quickly) dissolves in the air.

joosteto | 7 years ago | on: Pointers Are More Abstract Than You Might Expect in C

When I compile the example, i get:

  0x7ffd0b57ebd0 0x7ffd0b57ebd8 0
OK, so gcc reordered a & b; I'll fix this by chaning the initialisation of p and q to:

  int *p = &a + 1;
  int *q = &b;
But when I now run the example, I get:

  gcc -o c c.c && ./c
  0x7ffe55eb0aa4 0x7ffe55eb0aa4 1

  gcc -O -o c c.c && ./c
  0x7ffcfeffd914 0x7ffcfeffd914 0
So, p==q only evaluates to 1 if optimisation is enabled.

  $ gcc --version
  gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0
page 1