Skip to content

Instantly share code, notes, and snippets.

View baoshan's full-sized avatar

Baoshan Sheng baoshan

  • International Classical Music Database
  • Beijing, China
View GitHub Profile
@ChunMinChang
ChunMinChang / ChannelLayout.cpp
Last active June 5, 2020 09:52
CoreAudio Playground #coreaudio #multichannel_audio
#include <cassert>
#include <cstdlib>
#include <iostream>
#include <AudioUnit/AudioUnit.h>
#include <CoreAudio/CoreAudio.h>
#define kAudioUnitOutputBus 0
#define kAudioUnitInputBus 1
@marcelo-ribeiro
marcelo-ribeiro / javascript-remove-accents.js
Last active July 12, 2025 21:44 — forked from fabiofdsantos/angularJS_removeAccents.js
An Javascript function to remove accents and others characters from an input string.
// Example: https://codepen.io/marcelo-ribeiro/pen/OJmVOyW
const accentsMap = new Map([
["A", "Á|À|Ã|Â|Ä"],
["a", "á|à|ã|â|ä"],
["E", "É|È|Ê|Ë"],
["e", "é|è|ê|ë"],
["I", "Í|Ì|Î|Ï"],
["i", "í|ì|î|ï"],
["O", "Ó|Ò|Ô|Õ|Ö"],
@shafik
shafik / WhatIsStrictAliasingAndWhyDoWeCare.md
Last active July 15, 2025 16:15
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