Warning: INSERT command denied to user 'dbo292345962'@'' for table 'watchdog' query: INSERT INTO watchdog (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (0, 'php', '%message in %file on line %line.', 'a:4:{s:6:\"%error\";s:12:\"user warning\";s:8:\"%message\";s:399:\"INSERT command denied to user 'dbo292345962'@'' for table 'captcha_sessions'\nquery: INSERT into captcha_sessions (uid, sid, ip_address, timestamp, form_id, solution, status, attempts) VALUES (0, 'da7cefdf693f93a749a0fdcdfe491fa4', '', 1591083017, 'comment_form', '46691f0204f20d81a5feca9eeb322ef3', 0, 0)\";s:5:\"%file\";s:62:\"/homepages/25/d199835659/htdocs/ID/modules/captcha/captcha.inc\";s:5:\"%line\";i:99;}&# in /homepages/25/d199835659/htdocs/ID/includes/database.mysql.inc on line 135
C++ Volatile Keyword | Inferno Development

C++ Volatile Keyword

Volatile keyword can be specified for any C++ variable in order to tell the compiler that the variable should not be optimized. I'll show you what this means and why this Computer Engineering secret is very rare to find in any code. It's used in multi-threaded code or embedded system designs.

Take this code for example:

volatile int importantCheck;

void InterruptOrThread(){
  importantCheck = 5;

void main(){
  importantCheck = 0;
  if(importantCheck == 5){

If we did not have the volatile keyword on importantCheck integer, then the compiler will optimize this code, because the InterruptOrThread() function isn't called directly by the main thread, but it is called as a thread or an interrupt in an embedded system.

Volatile means that the C++ variable should not be optimized.

The compiler will remove the check "importantCheck == 5" and it will remove the LaunchProgram() function, because the compiler believes that it's a mistake and that importantCheck will never be 5, so it removes it.

Volatile is used in multi-threaded or interrupt driven programs because the compiler shouldn't optimize all variables because compilers cannot understand threads very well.

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account associated with the e-mail address you provide, it will be used to display your avatar.