Changes between Version 6 and Version 7 of const


Ignore:
Timestamp:
May 13, 2010, 5:26:26 PM (10 years ago)
Author:
andersk@mit.edu
Comment:

State explicitly that foo ** may be implicitly converted to foo *const *.

Legend:

Unmodified
Added
Removed
Modified
  • const

    v6 v7  
    1616`foo *` may be implicitly converted to `const foo *`, but not the other way around.
    1717
    18 `foo **` may ''not'' be converted to `const foo **`.  (Otherwise, you could write through `const foo *p` as follows: `foo *q; const foo **pq = &q; *pq = p; *q = …;`)
     18`foo **` may be implicitly converted to `foo *const *` (as a special case of the above), but may ''not'' be converted to `const foo **` (otherwise, you could write through `const foo *p` as follows: `foo *q; const foo **pq = &q; *pq = p; *q = …;`).
    1919
    2020However, it is safe to convert `foo **` to `const foo *const *`.  C++ lets you do this implicitly (conv.qual 4 in the standard); for no particular reason, C does not.