修饰变量,说明该变量不可以被改变; 修饰指针,分为指向常量的指针(pointer to const)和自身是常量的指针(常量指针,const pointer); 修饰引用,指向常量的引用(reference to const),用于形参类型,即避免了拷贝,又避免了函数对值的修改; 修饰成员函数 ...
Does it ever make sense to declare a variable in C or C++ as both volatile (in other words, “ever-changing”) and const (“read-only”)? If so, why? And how should you combine volatile and const properly ...
In this series, I'm exploring a handful of guidelines from the C++ Core Guidelines project. You can always find the latest version on GitHub-- look at the ...
Some books say it is unnecessary to add const to non-pointer/reference/array parameters, and advise learning programmers not to do so. But I like functino-headers ...
In this series, I'm exploring a handful of guidelines from the C++ Core Guidelines project. You can always find the latest version on GitHub-- look at the ...