There are a few things about linking that I think are worthy of writing down after I studied linking from CSAPP-3e and some resources on the web. Linkage of const Global Variables const global variables in C++ have internal linkage (as declared static) unless they’re explicitly declared extern or inline (see C++17 inline variable), whereas …
Author Archives: Mark Taylor
You Are So Beautiful by Joe Cocker
Loop-invariant Code Hoisting
We often face such a scenario in writing code: The flag is usually a constant, for example, an argument (e.g. true/false; 0/1) we passed to this function at runtime. The functions do_something() and do_something_else() may also be some code blocks and they’re almost identical. Well, if we know the flag will definitely not change within …
Awesome Netcat
We can turn any process into a server in an incredibly simple manner using the powerful networking utility netcat. For example, we can make a shell a server: Now let’s try to understand the above-highlighted line. Noting that a pipeline runs in parallel, cat fifo therefore outputs the content of fifo only when nc -l …
Zero Pointer Dereference, Huh?
Consider the following code: So, do you think the above two highlighted lines will crash the program? Well, at least to me, it will, since they’re dereferencing null pointers. Take, int b = (int) &((struct s *)0)->m2;, for example, we first dereference the zero pointer to get the member m2, and then obtain its address. …
An Amazing Mathemusician
Recently I found a beautiful, funny, intelligent woman, Vi Hart, a YouTuber who creates entertaining, thought-provoking mathematics and music videos that explain mathematical concepts through doodles. It is an absolutely delightful and enlightening experience to watch her doodling, drawing those beautiful, adorable mathematical geometric shapes. Besides, she explains those mathematical concepts in a singing tone, …
Awesome Swiss Tables
The basic idea is open addressing, but without any redirections (thus making Swiss tables very memory efficient). Also, Swiss tables store a densely packed array of metadata with each entry consisting of 1 byte (which makes the metadata table easier to fit into the CPU cache, as opposed to, say, metadata of pointers of 8 …
Founding Our Awesome Kick-ass Company
Today is a special occasion (& might be a historic moment) that we might appreciate a few years later: I, Yichuan Wang, & Robin Qiu just founded our own company. We were roomies in college, and they’re brilliant & awesome guys, and I firmly believe in a few years we will create a very bright …
Monty Hall Problem
This problem is actually a little tricky and counterintuitive, but really fun to think about (as a brain teaser). Here is the problem (I’ll just copy it from Wikipedia, lazy evil being :) Suppose you’re on a game show, and you’re given the choice of three doors: Behind one door is a car; behind the …
A Wet Dream You’ll Never Wanna Wake Up From
I just couldn’t believe it, … seemed after I told Ania how desperately, madly I’ve fallen love with her, we gazed into each other’s eyes, and…, and the most amazing, exciting thing that I’ve always dreamed of happened… WOW, she kissed me passionately, it was a big sloppy kiss, a minutes-long tongue kiss, a hell …
Continue reading “A Wet Dream You’ll Never Wanna Wake Up From”