Skip to content

Instantly share code, notes, and snippets.

View stepancheg's full-sized avatar

Stepan Koltsov stepancheg

View GitHub Profile
#!/usr/bin/env python
import sys
import threading
import os
class MyThread(threading.Thread):
def run(self):
sys.exit(1)
template <typename T>
class foo {};
int main() {
foo<1> x;
return 0;
}
===
#define UNW_LOCAL_ONLY
#include <libunwind.h>
#include <signal.h>
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
struct aaa {
const int x;
aaa(): x(1) {}
};
int main() {
aaa a;
aaa b;
b = a; // compilation error
struct aaa {
const int x;
aaa(): x(1) {}
};
int main() {
aaa a;
aaa b;
b = a; // compilation error

В программах, говорят, 90% времени работает 10% кода. И оптимизировать надо эти 10% кода, а оставшиеся 90% кода писать так, чтобы было удобно сопровождать.

Примерно так же надо относиться к городу. Духовность на 90% пространства города надо сохранять, а 10% самых используемых пространств улучшить — переименовать станции, упростить навигацию, сделать удобным.

Карта метро — это 0,0000001 духовности города, зато она доставляет

void foo(long* x, long* y) {
__atomic_store_n(x, 17l, __ATOMIC_SEQ_CST);
__atomic_store_n(y, 19l, __ATOMIC_SEQ_CST);
}
void bar(long *x, long* y) {
*x = 21l;
*y = 23l;
}
.file "qw.c"
.text
.p2align 4,,15
.globl foo
.type foo, @function
foo:
.LFB0:
.cfi_startproc
movq $17, (%rdi)
mfence
.file "./qw.c"
.text
.globl foo
.align 16, 0x90
.type foo,@function
foo: # @foo
.cfi_startproc
# BB#0: # %entry
movl $17, %eax
xchgq %rax, (%rdi)
struct Foo;
struct Bar {
Foo foo;
};
struct Foo {
};
int main() {