Skip to content

Instantly share code, notes, and snippets.

View lc0305's full-sized avatar
:shipit:

Lucas Crämer lc0305

:shipit:
  • Suttgart
View GitHub Profile
@nico
nico / c_inline.md
Last active July 25, 2023 18:43
C vs C++ inline function semantics, and ODR vs /arch:

The semantics of inline are one of the areas where C and C++ are pretty different. This post is about the C++ semantics, but the history is interesting, so here's a short summary of it.

The meaning of "inline" is intuitively easy to understand: It gives the compiler a hint that it'd be nice if a function could be inlined. It gets a bit complicated because of two issues:

  1. If the function ends up not being inlined, where should the definition of the function be emitted?
  2. If the inline function contains a static local variable, should that be inlined? Should there be several copies of the static local, or just one?
@cjonesy
cjonesy / macbook_pro_ubuntu_install.md
Last active April 26, 2024 09:28
Installing Ubuntu on MacBook Pro

Macbook Pro - Ubuntu Install

Requirements

2 USB drives > 2GB

Pre-Install

Create bootable USB drive

  1. Grab the latest Ubuntu Desktop iso image
@FiloSottile
FiloSottile / 32.asm
Last active March 23, 2024 12:28
NASM Hello World for x86 and x86_64 Intel Mac OS X (get yourself an updated nasm with brew)
; /usr/local/bin/nasm -f macho 32.asm && ld -macosx_version_min 10.7.0 -o 32 32.o && ./32
global start
section .text
start:
push dword msg.len
push dword msg
push dword 1
mov eax, 4
@marcetcheverry
marcetcheverry / mapread.c
Created May 25, 2011 14:05
mmap and read/write string to file
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <unistd.h>
int main(int argc, const char *argv[])
{