下面两个铸件有什么区别吗?铸造虚空指针
int a=10;
int *p=&a;
(void)p; //does not give any warning or error
或
(void *)p; //error: statement with no effect [-Werror=unused-value]
时gcc -Wall -Werror --std=c99 -pedantic
Just saw that in this answer.遵守(显然我误解的东西)
由'p'指向的地址前的铸造值是否有任何变化? – ameyCU
@ameyCU nopes。只有在有副作用的情况下,才会生效,而这种情况并非如此。 –
并且再次将'p'转换为'int *'将会安全吗? – ameyCU