The C Iceberg

5 points by hugoarnal


mira

Hmm, there's an incredible amount you could talk about here – even just about one subtopic – so it's a bit disappointing that the video is so short. It's also a bit unclear at times, e.g. about whether some behavior is part of the C standard or of its implementations, or by describing functions as unsafe without a definition for what unsafe means.

I'll leave a tidbit – maybe a bit below the waterline – about C implicitly changing integer types:

int16_t a = 20000;
int16_t b = a + a;

This snippet above is perfectly valid on platforms with > 16 bit integers, but is undefined behavior when int is 16 bit, even though you've only used fixed size types (because of promotion).

signed int c = -2;
unsigned int d = 1;
if(c + d > 0)
  puts("1 + -2 > 0");

And here, the puts gets executed due to balancing.