VS
Size: a a a
VS
v
VS
malloc
и прочих, возвращаются объекты, для создания и уничтожения которых не нужно выполнять никакого кодаVS
nullptr
не был нулемПК
ПК
ПК
S
m
ПК
When the /volatile:ms compiler option is used—by default when architectures other than ARM are targeted—the compiler generates extra code to maintain ordering among references to volatile objects in addition to maintaining ordering to references to other global objects. In particular:
A write to a volatile object (also known as volatile write) has Release semantics; that is, a reference to a global or static object that occurs before a write to a volatile object in the instruction sequence will occur before that volatile write in the compiled binary.
A read of a volatile object (also known as volatile read) has Acquire semantics; that is, a reference to a global or static object that occurs after a read of volatile memory in the instruction sequence will occur after that volatile read in the compiled binary.
This enables volatile objects to be used for memory locks and releases in multithreaded applications.
ПК
S
volatile int x;на Asm получилось:
void Foo() {
++x;
}
push ebpнету тут LOCK для atomic семантики
mov ebp, esp
; Line 4
mov eax, DWORD PTR ?x@@3HC ; x
add eax, 1
mov DWORD PTR ?x@@3HC, eax ; x
; Line 5
pop ebp
ret 0
VS
ПК
volatile int x;на Asm получилось:
void Foo() {
++x;
}
push ebpнету тут LOCK для atomic семантики
mov ebp, esp
; Line 4
mov eax, DWORD PTR ?x@@3HC ; x
add eax, 1
mov DWORD PTR ?x@@3HC, eax ; x
; Line 5
pop ebp
ret 0
dmb ish
ПК