简体   繁体   中英

Is there a difference between the address operator and a pointer in assembly?

does the compiler translate the address operator any different than a pointer?

I'm wondering because the decompiler sometimes shows me:

func_test(&a, &b[0x32*ebx])

which should be essentially the same as

func_test((_DWORD *)a,(_DWORD *)(b+0x32*ebx))

correct? I'm mildy confused by the arithmetic tbh. Does it have any special meaning having it shown this way or is this just to read it easier?

&a returns the address of a , while (_DWORD *)a forces the compiler to reinterpret the content of a as a pointer to a _DWORD . so the two expressions are fundamentally different.

It may be equivalent if a is an array of _DWORD (declared like _DWORD a[A_LENGTH]; ). In this case &a and a is essentially the same as a in pointer context degrades to a simple pointer, allthough the _DWORD * cast is redundant then.

The expression for b is equivalent.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM