ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Воскресенье
19 мая
183028 Топик полностью
Cepгeй Бopщ (25.02.2010 13:07, просмотров: 110) ответил Cepгeй Бopщ на Да, вы правы. Это я с С++ попутал - там неявно приводится к void *, обратно - только явно.
Чтобы прекратить спор выше - выдержки из стандартов: C99 = ISO/IEC 9899:1999 (E):
6.5.16.1 Simple assignment Constraints 1 One of the following shall hold: ... -one operand is a pointer to an object or incomplete type and the other is a pointer to a qualified or unqualified version of void,and the type pointed to by the left has all the qualifiers of the type pointed to by the right;
C++ = ISO/IEC 14882:2003(E)
4 Standard conversions 1 Standard conversions are implicit conversions defined for built-in types. Clause 4 enumerates the full set of such conversions. 4.10 Pointer conversions 2 An rvalue of type “pointer to cv T,” where T is an object type, can be converted to an rvalue of type “pointer to cv void.” The result of converting a “pointer to cv T” to a “pointer to cv void” points to the start of the storage location where the object of type T resides, as if the object is a most derived object (1.8) of type T (that is, not a base class subobject). 5.2.9 Static cast 10 An rvalue of type “pointer to cv1 void” can be converted to an rvalue of type “pointer to cv2 T,” where T is an object type and cv2 is the same cv-qualification as, or greater cv-qualification than, cv1. A value of type pointer to object converted to “pointer to cv void” and back to the original pointer type will have its original value.