由于某种原因,我正在寻找的代码有很多类似的东西
char tmp [4];
的memcpy(&安培; TMP [0],foo_pointer,bar_size)
我本来希望的
char tmp [4];
的memcpy(TMP,bar_size)
有没有什么理由让我在第一时间写作呢?
解决方法
不,他们是平等的.
即使没有看到tmp的定义,前者也可能更清晰.
(并且只是为了让这个答案完整,为什么会这样,这里有一点来自标准草案的晚期:)
(6.3.2.1p3) Except when it is the operand of the
sizeof
operator,the_Alignof
operator,or the
unary&
operator,or is a string literal used to initialize an array,an expression that has
type “array of type” is converted to an expression with type “pointer to type” that points to the initial element of the array object and is not an lvalue. If the array object has register storage class,the behavior is undefined.