Skip to content

Commit

Permalink
Create Matrix-A.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Matrix-A authored Dec 7, 2023
1 parent a307c8c commit 411c1f3
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/群友提交/第14题/Matrix-A.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include<iostream>
#include<cstdint>

namespace ss {
int a = 0;
}

#if defined(_MSC_VER)
#define MAIN_ATTRIBUTES __pragma(optimize("", off))
#elif defined(__clang__)
#define MAIN_ATTRIBUTES [[clang::optnone]]
#else
#define MAIN_ATTRIBUTES [[gnu::optimize(0)]]
#endif

int b = 0;
MAIN_ATTRIBUTES
int main() {
*(int*)((uint8_t*)&b - sizeof(int)) = 100;
*(int*)((uint8_t*)&b + sizeof(int)) = 100;
std::cout << ss::a << '\n';
}

0 comments on commit 411c1f3

Please sign in to comment.