This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Primitive data is said to be aligned if the memory address where it is stored is a multiple of the size of the primitive. | |
https://accu.org/conf-docs/PDFs_2008/Alexandrescu-memory-allocation.screen.pdf | |
*/ | |
size_t alignment = 2; /* 2^aligment is the size of the chunk */ | |
size_t adj = alignment - 1; | |
size_t sz = (requested_size + adj) & ~adj; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
double price = 18.90; | |
// DO :) | |
int cents = (int) (price * 10000.); | |
cents /= 100; | |
// cents is 1890 | |
// DON'T! | |
cents = (int) (price * 100.); | |
// cents is 1889 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Build qtbrowser with Qt5 in Linux | |
# https://github.com/Metrological/qtbrowser | |
# | |
# Usage: | |
# ./install-qtbrowser.sh build-icu build-openssl build-qt build-qtbrowser | |
# | |
# Compile as a static library: | |
# ./install-qtbrowser.sh build-icu build-openssl build-qt build-qtbrowser static | |
# |