What Volatile Means (and Doesn’t Mean) in C++ Programming - Ben Saks - CppCon 2024

  Рет қаралды 9,994

CppCon

CppCon

Күн бұрын

Пікірлер: 44
@kimicochiang
@kimicochiang 2 ай бұрын
Thanks! I really appreciated Ben and Dan who gave us opportunities to deep dive into c and c++.
@xorbe2
@xorbe2 2 ай бұрын
primer at 0:36 volatile at 20:29 summary at 44:05 audience questions at 46:40
@LS-cb7lg
@LS-cb7lg 2 ай бұрын
Great talk. good thing i knew most of it already, but a great refresher nonetheless :) the workaround with the opaque functions is a good thing to keep in mind!
@azdinator
@azdinator 2 ай бұрын
Now that I've watched the whole video : I apologize. This is great job. Thank you Mr. Saks.
@TechTalksWeekly
@TechTalksWeekly 2 ай бұрын
This is an excellent talk and it has been featured in the latest issue of 💥Tech Talks Weekly. Congrats!
@NEWDIABLO96
@NEWDIABLO96 2 ай бұрын
9:17 more NOP/s seem like a good metric!
@StanleyPinchak
@StanleyPinchak 2 ай бұрын
🤣
@milasudril
@milasudril 2 ай бұрын
Can the language be made more expressive in order to prevent compiler bugs related to volatile?
@sanjaygatne1424
@sanjaygatne1424 2 ай бұрын
नीट समजावून सांगितले. होलाटाइल बद्दलच्या शंका दुर झाल्या. धन्यवाद.
@АлександрРоманов-э8ъ5о
@АлександрРоманов-э8ъ5о 2 ай бұрын
Thanks! It looks like slide 41 missing pointer dereference
@АндрейЛащев-м6ж
@АндрейЛащев-м6ж 2 ай бұрын
The speaker looks like Peter Gregory from Silicon Valley Series. 🙂
@japedr
@japedr 2 ай бұрын
To be fair, I believe one of the mistakes of C and C++ is that the value and not the address is what is declared volatile, where it only makes sense in practice is when it's under a pointer/reference. I believe a much more cleaner solution would be having special functions like "volatile_read" and "volatile_write" that modify volatile memory locations. That would even allow adding non-volatile read and writes mixed in where needed; or even hardware-specific functions with their own particular set of guarantees (e.g. "semi-volatile").
@ZeroPlayerGame
@ZeroPlayerGame 2 ай бұрын
What does it even mean to have one volatile and one non-volatile access to the same memory location? Also, in C++, like C, unlike e.g. Rust, each value has a definite place in memory which can only be "changed" by copying or moving out, so the distinction is not very meaningful.
@Fardin.Alizadeh
@Fardin.Alizadeh 2 ай бұрын
you are more Peter Gregory that Peter Gregory itself =))))
@Minty_Meeo
@Minty_Meeo 2 ай бұрын
This is sort of interesting, but about halfway through I had to put it on 1.5x speed because the speaker has a really slow and choppy speaking rhythm.
@jefffriedman6942
@jefffriedman6942 2 ай бұрын
it shouldn't take an hour to learn what volatile is. this is a core problem with c++ and the people surrounding it. 1 hour presentations in a world that had already been dominated by 140 characters over a decade ago.
@ZeroPlayerGame
@ZeroPlayerGame 2 ай бұрын
have you watched the talk or just read the title and looked at runtime
@srnissen_
@srnissen_ 2 ай бұрын
Explaining how to use it takes a second if you're not touching hardware ("don't"), one sentence if you're doing C++ ("The standard says it does the same as C"), and one (different) sentence if you're doing C ("Ask your hardware provider.") I would be wildly surprised to learn that it's any different for Zig or Rust. "What it is" can take arbitrarily long, depending on how long of a history lesson you want.
@ShtrikeBirb
@ShtrikeBirb 2 ай бұрын
So true
@juliovata9194
@juliovata9194 2 ай бұрын
@@jefffriedman6942 it’s a feature adopted from C…
@japedr
@japedr 2 ай бұрын
Within 140 characters: Just use volatile for memory mapped hardware registers as the compiler would generate wrong code otherwise. Do not use it for other purposes. For the longer explanation, watch the talk. I mean, I agree that often C++ is overly complicated, but this particular issue affects all low-level languages with an optimizing compiler (like pure C, Rust, Zig or even Ada). The only way to avoid this problem is to write the assembly code yourself.
@klcousins
@klcousins 2 ай бұрын
Jesus, Mary, and Joseph! Lose the water! So distracting!
@klcousins
@klcousins 2 ай бұрын
I mean: just how dehydrated can one GET during a 𝘖𝘕𝘌 𝘏𝘖𝘜𝘙 presentation?
@ABaumstumpf
@ABaumstumpf 2 ай бұрын
Volatile - an problem created by the C++ committee not understanding what volatile means, why it was defined in C as it was, or what it is meant to be used for. And then in an attempt to solve the problem we got std::atomic: it does not even come close to resolving the problems `volatile` was misused for. It says nothing about actual atomicity but instead deals with memory-fencing and can also be locking. volatile means that any operations on that object are to be treated as if they have sideeffects. Nothing less, nothing more.
@kuhluhOG
@kuhluhOG Ай бұрын
it's not a problem created by the C++ committee the C++ committee just saw that a lot of C and C++ programmers (yes, both groups) used volatile wrong and thought it needs to do something about it furthermore, atomic and volatile are orthogonal to each other and the former is necessary to write performant multiple thread code with shared data without needing to drop down to assembly; there's a reason why C has _Atomic (and no, it's not C++ compatibility)
UFC 287 : Перейра VS Адесанья 2
6:02
Setanta Sports UFC
Рет қаралды 486 М.
24 Часа в БОУЛИНГЕ !
27:03
A4
Рет қаралды 7 МЛН
She wanted to set me up #shorts by Tsuriki Show
0:56
Tsuriki Show
Рет қаралды 8 МЛН
Intro to Computer Science and Programming in Python 4 of 12
53:28
Intro to Java Programming - Course for Absolute Beginners
3:48:25
freeCodeCamp.org
Рет қаралды 3,7 МЛН
Lean for Scientists and Engineers, Summer 2024 - Lecture 7
2:02:40
Tyler Josephson
Рет қаралды 35
Data Analytics Using Python Chapter 1 Video 3
1:17:35
CS Courses
Рет қаралды 190
UFC 287 : Перейра VS Адесанья 2
6:02
Setanta Sports UFC
Рет қаралды 486 М.