Content deleted Content added
→top: word choice |
change C2X to C23 |
||
Line 266:
The latter loophole can be closed by using a class to hide the pointer behind a <code>const</code>-correct interface, but such classes either do not support the usual copy semantics from a <code>const</code> object (implying that the containing class cannot be copied by the usual semantics either) or allow other loopholes by permitting the stripping of <code>const</code>-ness through inadvertent or intentional copying.
Finally, several functions in the [[C standard library]] violate const-correctness before [[
Some implementations of the C++ standard library, such as Microsoft's<ref>{{cite web|url=https://msdn.microsoft.com/en-us/library/b34ccac3.aspx |title= strchr, wcschr, _mbschr (CRT) |publisher= Msdn.microsoft.com |date= |accessdate= 2017-11-23 }}</ref> try to close this loophole by providing two [[function overloading|overloaded]] versions of some functions: a "<code>const</code>" version and a "non-<code>const</code>" version.
Line 309:
This allows idiomatic C code but does strip the const qualifier if the input actually was const-qualified, violating type safety. This solution was proposed by Ritchie and subsequently adopted. This difference is one of the failures of [[compatibility of C and C++]].
Since [[
== D ==
|