Changes between Version 7 and Version 8 of const


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

Clarify which void * conversions work in C++.

Legend:

Unmodified
Added
Removed
Modified
  • const

    v7 v8  
    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.
    2121
    22 In C, `void *` may be implicitly converted to and from `foo *`, and hence also to `const foo *`.  `const void *` may be implicitly converted to and from `const foo *`, and hence also from `foo *`.
     22`foo *` may be implicitly converted to `void *`, hence also to `const void *`, but `const foo *` may only be converted to `const void *`.  In C (but not C++), `void *` may be converted to `foo *`, hence also to `const foo *`, but `const void *` may only be converted to `const foo *`.
    2323
    2424== How `const` relates to `malloc` and `free` ==