Você está na página 1de 2

X

: : 15.03.2011 .
char *(X[64]); cout << sizeof(&X) << endl;

sizeof(&X), "char *X[n];" ?

, 4 Win32 , .
char *(X[64]); memset(&X, 0, sizeof(& X));

? , , : 8 Win64

" .

".

. .

X.

VS 2005 ,

, VS 2005 SP1.

"sizeof(&X)" . .

, Framework:
class TestForSP1 {

Google C++ Mocking

private: // GCC complains if x_ is used by sizeof before defining it. static char x_[100]; // VS 2005 RTM incorrectly reports sizeof(&x) as 100, and that value

// is used to trigger 'invalid negative array size' error. If you // see this error, upgrade to VS 2005 SP1 since Google Mock will not // compile in VS 2005 RTM. static char

Google_Mock_requires_Visual_Studio_2005_SP1_or_later_to_comp ile_[ sizeof(&x_) != 100 ? 1 : -1]; };

"&X". . :
memset(&X, 0, sizeof(X)); memset(X, 0, sizeof(X));

, sizeof(X) . .

sizeof(&X)

Você também pode gostar