[conv.ptr]
Change: Converting void* to a pointer-to-object type requires casting
char a[10]; void *b=a; void foo() { char *c=b; }
ISO C will accept this usage of pointer to void being assigned
to a pointer to object type.
C++ will not.
Rationale:
C++ tries harder than C to enforce compile-time type safety.
Effect on original feature:
Deletion of semantically well-defined feature.
Difficulty of converting:
Could be automated.
Violations will be diagnosed by the C++ translator.
The
fix is to add a cast.
For example:
char *c = (char *) b;
How widely used:
This is fairly widely used but it is good
programming practice to add the cast when assigning pointer-to-void to pointer-to-object.
Some ISO C translators will give a warning
if the cast is not used.
[conv.ptr]
Change: Only pointers to non-const and non-volatile objects may be implicitly converted to void*
Rationale:
This improves type safety.
Effect on original feature:
Deletion of semantically well-defined feature.
Difficulty of converting:
Could be automated.
A C program containing such an implicit conversion from, e.g.,
pointer-to-const-object to void* will receive a diagnostic message.
The correction is to add an explicit cast.
How widely used:
Seldom.