The Wealth of a Language Relies Upon Its Words

emmtrix Tech Posts: Work & Fun with C++ Standard
Category: Fun Facts

Throughout the C++ standard, the words “may” and “shall” require special attention. They are two of the most commonly used words, and their impact can be enormous.

The word “may” is a tricky one when the text it is contained in is to be tested. A particular result cannot be guaranteed: Something may or may not happen!

In the case of the word “shall”, its meaning should be obvious, but it may not be. As part of a requirement (or, more simply, any text within a standard), “shall” shall be considered a “must”! If a specified behavior is violated (i.e., the opposite of what “shall” happen), you get either an exception or an unspecified behavior, so “shall” is too soft a word.

Now let’s move away from the common words and consider another, rather rarely used word.

A language must define words, but it seems that the standard of a language is an untouchable master that can act as it pleases. It can use words without even defining them! Such is the word “constness”.

Task: What do you think the definition of the word could be? Maybe you could help since the standard does not. 😉

Do not overthink, there is no 100% correct answer since the definition does not actually exist. 😊 This is an easy one and a warmup for the follow-up posts.

Stay tuned!

____

Read on if you want to know the solution to the tasks…

constness /ˈkɒnstnəs/
noun
1. [Programming] state of being constant
“It is not necessary to cast away the constness of the pointer expression before it is used as the operand of the delete-expression.” – C++ standard
2. [General life] state or quality of remaining unchanged or unalterable
“Constness of change is indisputable.” – ancient Greek philosopher Heraclitus

With our contribution, constness may now become part of the English vocabulary. 😉

Cookie Consent with Real Cookie Banner