What is Bound Checking Concept? And what are scalar variables and constant initializers? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is Bound Checking Concept? And what are scalar variables and constant initializers?

Want to know more about static declaration and run time declaration

13th Sep 2017, 4:03 AM
Ishu Maurya
Ishu Maurya - avatar
2 Answers
+ 10
Bounds checking is any method of detecting whether a variable is within some bounds before it is used. It is usually used to ensure that a number fits into a given type (range checking), or that a variable being used as an array index is within the bounds of the array (index checking) . A scalar variable, or scalar field, is a variable that holds one value at a time. It is a single component that assumes a range of number or string values. A scalar value is associated with every point in a space. Scalar variables can be either a number or a string -- What might seem confusing at first sight actually makes a lot of sense and can make programming a lot easier. You can use variable types almost interchangeably. Numbers first then strings later. Numbers are numbers -- there is no integer type per se. Constant initialization is performed after (until C++14)instead of (since C++14) zero initialization of the static and thread-local objects and before all other initialization. Only the following variables are constant initialized: 1) Static or thread-local references, if it is bound to static glvalue, to a temporary object (or its subobject), or to a function. and if every expression (including implicit conversions) in the initializer of the reference is a constant expression. 2) Static or thread-local object of class type that is initialized by a constructor call, if the constructor is constexpr and all constructor arguments (including implicit conversions) are constant expressions, and if the initializers in the constructor's initializer list and the brace-or-equal initializers of the class members only contain constant expressions. 3) Static or thread-local object (not necessarily of class type), that is not initialized by a constructor call, if the object is value-initialized or if every expression in its initializer is a constant expression.
13th Sep 2017, 9:53 AM
Egi Shehu
Egi Shehu - avatar
0
can i have a little ans.. i didnt understood this
16th Sep 2017, 3:19 PM
Ishu Maurya
Ishu Maurya - avatar