Encapsulation contains a function’s implementation details and local state within its call. Local variables and parameters are visible only inside the function, receive fresh storage on each call, and disappear when execution leaves the function. section 7.3
Recursive function calls
In gcd2, each recursive call receives a new pair of parameters and its own local remainder. An active caller’s locals remain separate from those of the callee, so recursive calls do not create identifier conflicts. section 7.3
inline size_t gcd2(size_t a, size_t b) [[__unsequenced__]] { 1
assert(a <= b); 2
if (!a) return b; 3
size_t r = b % a; 4
return gcd2(r, a);
}
Inspect the compact gcd2 implementation to see encapsulation operating alongside assertions, local variables, and recursive calls. section 7.3













