Skip to content
0:00 / 0:00

#volatile#cppcon#concurrency

Deprecating volatile - JF Bastien - CppCon 2019

CppCon

189K subscribers • 103 videos on Hallway • Conference channel

YouTube
  • Recommended by 3 people: 3 in engineering communities.
  • A classic. People kept recommending it from 2019 to 2023.
  • Presented by JF Bastien
  • Linked in the descriptionCppCon/CppCon2019
  • An opinion. It argues one side of a question engineers disagree on.

Advanced. Deep dive for people who know the field.

30K views7 years ago3 recommendations

Programming languagesSystems programmingC++CLanguage design and type systems

JF Bastien explains why the volatile keyword is problematic in C and C++ and details the efforts to deprecate its broken uses.

CppCon.org — Discussion & Comments: reddit.com/r/cpp/ — Presentation Slides, PDFs, Source Code and other presenter materials are available at: github.com/CppCon/CppCon2019 — Dealing with volatile in C and C++ is problematic in large parts because what the Standards say isn’t very intuitive and often error-prone. Indeed, volatile isn’t specified normatively, has relatively obscure uses, and is surrounded by myths and legends. This is especially troublesome because volatile is most used to interact with hardware and perform other tricky operations in low-level code. We’ve determined that the languages should be improved and are actively working in that direction: deprecate the dubious and obviously broken uses of volatile in both languages though the C and C++ Standards Committees, standardize replacements which are less error-prone, create advanced diagnostics to help developers write better code. Our ultimate goal: deprecate what remains of volatile. This talks first helps developers understand volatile because it’s often misunderstood. With that understanding, developers are then walked through the deprecation and replacement plan we’ve set out. — JF Bastien Compiler engineer, Apple JF is a compiler engineer. He leads C++ development at Apple. — Videos Filmed & Edited by Bash Films: BashFilms.com Work at Hudson River Trading (HRT): tinyurl.com/safxfctf

Why it's here

3 people recommend this

What people say. Recommended as the definitive explanation of why volatile is insufficient for threading and how its usage is being restricted.

u/skeetoin r/C_Programming • Recommends

CppCon 2019: JF Bastien “Deprecating volatile”

u/not_a_novel_accountin r/C_Programming • Recommends

On “How do you implement a mutex ?”

`volatile` is completely insufficient for threading and such usage should be stamped out. As you mention, `volatile` has one usage and one usage only, that access not be omitted. It is suitable for memory mapped register access in embedded contexts and _nothing else_. This misconception that `volatile` is an appropriate tool for threading has been extensively covered by subject matter experts. Notably JF Bastien's "Deprecating Volatile" talk. I'm somewhat surprised you would bring it up, a lot of work was done to kill this idea over the last 15 years. Your compiler will absolutely optimize your locking algorithms out of existence or sequence your non-volatile instructions outside your vo…

u/sharricein r/C_Programming • Recommends

On “What is a dirty word to c and c++ programmers alike?”

wow you're getting downvoted hard for this they're literally deprecating the keyword link to this video