c++ - Order of const and volatile for a variable -



c++ - Order of const and volatile for a variable -

the next piece of code compiles , runs gcc version 4.7.2 (debian 4.7.2-5) :

#include <stdio.h> int main() { const volatile x = 3; volatile const y = 4; homecoming 0; }

should assume order of const , volatile irrelevant? tried reading here : encpp ref , doesn't order(or i'm missing it?)

yes, order irrelevant. in c++, relevant specification in 7.1p1, decl-specifier , decl-specifier-seq, explain there sequence of relevant keywords, , 7.1.6, lists const , volatile 2 these keywords. note production weird plenty these valid well, though in involvement of readability recommend against them:

const int volatile = 1; volatile int const b = 2; const int volatile typedef vcint; // defines vcint alias const volatile int

c++ c const volatile qualifiers

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

html - Submenu setup with jquery and effect 'fold' -

ruby on rails - Devise Logout Error in RoR -