Latest Tech News

Stay updated with the latest in technology, AI, cybersecurity, and more

Filtered by: rbp Clear Filter

Learn x86-64 assembly by writing a GUI from scratch (2023)

Learn x86-64 assembly by writing a GUI from scratch Discussions: Hacker News, r/programming, Lobsters. Most people think assembly is only to be used to write toy programs for learning purposes, or to write a highly optimized version of a specific function inside a codebase written in a high-level language. Well, what if we wrote a whole program in assembly that opens a GUI window? It will be the hello world of the GUI world, but that still counts. Here is what we are working towards: I wante

Topics: mov rax rbp rdi rsp

Shared_ptr<T>: the (not always) atomic reference counted smart pointer (2019)

shared_ptr<T>: the (not always) atomic reference counted smart pointer Introduction This is a write-up of the “behavioral analysis” of shared_ptr<T> reference count in GNU’s libstdc++. This smart pointer is used to share references to the same underlaying pointer. The mechanism beneath works by tracking the amount of references through a reference count so the pointer gets freed only after the last reference is destructed. It is usually used in multi-threaded programs (in conjunction with oth

Topics: atomic mov ptr rax rbp

C++: Zero-cost static initialization

Zero-cost statics in C++ "Усердие все превозмогает!" К. Прутков, Мысли и афоризмы, I, 84 In C and C++ a static variable can be defined in a function scope: int foo() { static int counter = 1; printf("foo() has been called %i times. ", counter++); ... } Technically, this defines counter as an object of static storage duration that is allocated not within the function activation frame (which is typically on the stack, but can be on the heap for a coroutine), but as a global object. This is o

Topics: foo int mov rbp static

C++: zero-cost static initialization

Zero-cost statics in C++ "Усердие все превозмогает!" К. Прутков, Мысли и афоризмы, I, 84 In C and C++ a static variable can be defined in a function scope: int foo() { static int counter = 1; printf("foo() has been called %i times. ", counter++); ... } Technically, this defines counter as an object of static storage duration that is allocated not within the function activation frame (which is typically on the stack, but can be on the heap for a coroutine), but as a global object. This is o

Topics: foo int mov rbp static