Skip to content

Instantly share code, notes, and snippets.


Mohamed A. Bamakhrama mohamed

View GitHub Profile
shafik /
Last active Sep 28, 2020
What is Strict Aliasing and Why do we Care?

What is the Strict Aliasing Rule and Why do we care?

(OR Type Punning, Undefined Behavior and Alignment, Oh My!)

What is strict aliasing? First we will describe what is aliasing and then we can learn what being strict about it means.

In C and C++ aliasing has to do with what expression types we are allowed to access stored values through. In both C and C++ the standard specifies which expression types are allowed to alias which types. The compiler and optimizer are allowed to assume we follow the aliasing rules strictly, hence the term strict aliasing rule. If we attempt to access a value using a type not allowed it is classified as undefined behavior(UB). Once we have undefined behavior all bets are off, the results of our program are no longer reliable.

Unfortunately with strict aliasing violations, we will often obtain the results we expect, leaving the possibility the a future version of a compiler with a new optimization will break code we th

P7h /
Last active Jul 14, 2020
tmux vs screen commands

tmux vs. screen commands

Action tmux screen
start a new session tmux
tmux new
tmux new-session
start a new session with a name tmux new -s name screen -S name
re-attach a detached session tmux attach
tmux attach-session
screen -r
re-attach a detached session with a name tmux attach -t name
tmux a -t name
screen -r name
re-attach an attached session (detaching it from elsewhere) tmux attach -d
tmux attach-session -d
screen -dr
dvarrazzo /
Last active Oct 11, 2015
ditaa ascii art diagrams in reStructuredText
#!/usr/bin/env python
"""Custom reST_ directive for ditaa_ integration.
.. _reST:
.. _ditaa:
import os
import tempfile
from zlib import adler32
You can’t perform that action at this time.