Skip to content
0:00 / 0:00

#undefinedbehavior#compileroptimization#c

Advanced C: The UB and optimizations that trick good programmers.

Eskil Steenberg

37K subscribers • 6 videos on Hallway

YouTube
  • Recommended by 2 people: 2 in engineering communities.
  • Presented by Eskil Steenberg
  • An opinion. It argues one side of a question engineers disagree on.

Advanced. Deep dive for people who know the field.

273K views4 years ago2 recommendations

Programming languagesSystems programmingCCompilers and interpretersPerformance and optimization

Eskil Steenberg discusses less-known aspects of C, undefined behavior, and how compiler optimizations can introduce subtle bugs.

This is a video that will talk about some less know things in the programming language C, and how these things impact optimizations and the kinds of bugs that they can produce. This is not a video for beginner programmers. You can find my work on: quelsolaar.com Socials: @eskilsteenberg Regularly stream on: twitch.tv/quel_solaar Join our Discord at: discord.com/invite/Scg6trNUyW

Why it's here

2 people recommend this

What people say. Highly recommended for understanding how undefined behavior and compiler optimizations can trick even experienced C programmers.

u/mgarcia_orgin r/C_Programming • Recommends

Eskil Steenberg: Advanced C: The Undefined Behavior and optimizations that trick good programmers.

u/tijdisallesin r/C_Programming • Recommends

Should something be done about undefined behavior in the next version of C standard? Having recently watched this video by Eskil Steenberg I am basically terrified to write a single line of C code in fear of it causing undefined behavior. Oh, and thanks for the nightmares Eskil. I am slowly recovering from having watched that video and am now wondering if something can be done about certain cases of undefined behavior in the next version of the C standard. I understand that backwards compatibility is paramount when it comes to C, but perhaps the standard can force compilers to produce warnings in certain UB situations? I'd like to know if you think something could (or should) be done ab…

u/DiceAndBricksin r/C_Programming • Mentions

On “Best Websites, YouTube channels and Blogs to follow for pure C development”

Two good videos by Eskil Steenberg, "How I Program C" link to this video "Advanced C: The UB and optimizations that trick good programmers", link to this video Several presentations on CppCon's YT channel are applicable to C.

u/TiagoPaoliniin r/C_Programming • Mentions

On “What are UBSan's limitations, and where to learn more about spotting UB?”

I would suggest having a look at CERT C Coding Standard. Also, I like this video: link to this video It goes in a great length to explain quite a few subtle ways that undefined behaviors may break the code. And there are some not so obvious programming tricks. About tools, I would use Valgrind and the GCC's sanitizers (leak, address, undefined).

u/grimvianin r/C_Programming • Mentions

On “came from c++ looking for advanced resource”

The C keywords you mentioned are beginner level and up to advanced is quite a jump. If you can handle pointers, structs and memory management, then go for it. Charles Cabergs - Advanced C: [video or Eskild Steenberg - Advanced C: The UB and optimizations that trick good programmers. [video

u/quelsolaarin r/C_Programming • Mentions

On “Why some people consider C99 "broken"?”

I don't agree with this. A lot of people try to retcon as-if out of C89, this is not correct. UB is UB and has always been. On the surface "why cant the compiler just do what i tell it to", makes sense, but as you dig deeper it becomes impossible to uphold. I very much understand your point of view and a number of years ago i would have agreed with you, but I know better now. I recomend this video if you want a deeper explanation of UB: Advanced C: The UB and optimizations that trick good programmers. - YouTube

u/grimvianin r/C_Programming • Mentions

On “Neuroscience research and C language”

Maybe these videos: Advanced C by Eskild Steenberg: The UB and optimizations that trick good programmers. [video Advanced C by Charles Cabergs: [video

u/grimvianin r/C_Programming • Mentions

On “Training Save C Code”

I must admit I don't think much the subject anymore. When I got tangled into something comprehensible I take a look at Eskild Steenberg's video: Advanced C: The UB and optimizations that trick good programmers [video

u/grimvianin r/C_Programming • Mentions

On “what projects can I make to learn c to its fullest ?”

I''ll suggest you try these videos: Advanced C by Eskild Steenberg: The UB and optimizations that trick good programmers. [video Advanced C by Charles Cabergs: [video Make a full adder and if that is too easy try emulate a 6502 processor.