I don't know if I should say but I never thought how the volatile keyword will change the context with it's placement! This was really crazy! Thank you!
@sageeuthanasia9324 Жыл бұрын
You are a real code guru 😮 Thank you!
@casalaamericana55785 жыл бұрын
Direct to "my favorites" list
@JoseGonzalez-rt5fk5 жыл бұрын
Fantastic; it's great explanation of C++ features that are usually shoved in the back. I love your video!
@MalamIbnMalam2 жыл бұрын
Is there an embedded course that Siemens has anywhere online?
@iamsuperwen6 жыл бұрын
please talk about the keyword const, thanks for all the nice educational videos!!
@mohamedel-hadidy48443 жыл бұрын
to sum it up, the volatile keyword prevents the variable from getting cached Thanks for the awesome explanation
@wew88202 жыл бұрын
no, not really from getting cached. the volatile keyword prevents the compiler from optimising away the variable and subsequent code whose access is controlled by that variable based on what value the variable has during static analysis/compilation. Consider a variable that is of type bool, and is set to 'true'. The compiler will see that and go "ok, I can just delete any code that would only be reached if this were false, because this is always going to be true". With volatile you tell the compiler "we don't know what this value will be at runtime, so don't be overly aggressive with your optimisation here, just leave it as is. the variable can change at any time during runtime, it's volatile, it's subject to change without notice"
@jordantaylor24377 жыл бұрын
Excellent video, thanks!
@viktorstanchev65677 жыл бұрын
Really well explained!
@rogerthat3655 жыл бұрын
Hoping my question is not stupid. //program 1 volatile int *x = new int; *x = 5; write(anybinaryfile, &x, sizeof(int*)); while(1); //program 2 volatile int *y; read(anybinaryfile, &x, sizeof(int*)); printf("%d", *y); /* should this work??? if run program 2 before shutting program 1. As when I tried to run program 2, it returned core dump. */
@aliakv13646 жыл бұрын
Very helpfull. Thanks a lot
@cfoch36 жыл бұрын
Awesome, thank you.
@madhavjha92 Жыл бұрын
I need to learn embedded programming from scratch.... could you please help
@dragosmakovei4 жыл бұрын
new subscriber!
@snjkmr0555 жыл бұрын
Just awesome..........
@gghhff33445 жыл бұрын
shared variable with another executable thread can be either global or external variable ? is am i right ? is there any more situation ? thank you so much
@EmbeddedSoftware5 жыл бұрын
Global and external are the same thing in C. Great care is needed when sharing variables between threads, as there must be atomic access. Better to use RTOS inter-task communication facilities.