Creating A GUI from scratch in C++ or assembly [closed]

In order to create a window you’ll need to interface with whatever windowing system is currently present on your operating system. This will either require system calls if the window manager runs in kernel space (as is the case in Windows) or some sort of interprocess communication for user space window managers (like X). To … Read more

Is there a way to enforce specific endianness for a C or C++ struct?

A bit late to the party but with current GCC (tested on 6.2.1 where it works and 4.9.2 where it’s not implemented) there is finally a way to declare that a struct should be kept in X-endian byte order. The following test program: #include <stdio.h> #include <stdint.h> struct __attribute__((packed, scalar_storage_order(“big-endian”))) mystruct { uint16_t a; uint32_t … Read more

How does the computer calculate Square roots? [closed]

Most modern non-embedded CPUs (x86 and the larger ARM cores, for example) have hardware instructions to compute square roots directly. The hardware implementation backing these instructions varies, but typically is a variant on the schoolbook digit-by-digit algorithm (though not always in base two; base four or sixteen can also be used). These are typically among … Read more

How does CheatEngine’s speed hack work?

Three years later, I think I know enough to answer my own question. 🙂 A computer program usually communicates with the kernel using predefined functions called system calls. Each OS has a different set of calls but often they do similar things like — allocating memory, reading and writing files, or handling processes. According to … Read more

How are 3D arrays stored in C?

At a low level, there is no such thing as a multi-dimensional array. There is just a flat block of memory, large enough to hold a given number of elements. In C, a multi-dimensional array is conceptually an array whose elements are also arrays. So if you do: int array[2][3]; Conceptually you end up with: … Read more

How to run a C program with no OS on the Raspberry Pi?

Fully automated minimal bare metal blinker example Tested on Ubuntu 16.04 host, Raspberry Pi 2. https://github.com/dwelch67/raspberrypi is the most comprehensive example set I’ve seen to date (previously mentioned on this now deleted answer), but this is a minimal easy to setup hello world to get you started quickly. Usage: Insert SD card on host Make … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)