Skip to content

Instantly share code, notes, and snippets.

@cellularmitosis
cellularmitosis / gcc-asm-notes.md
Last active January 23, 2022 23:43
Comparison of Assembly across five architectures

Blog 2020/1/27

<- previous | index | next ->

Comparison of Assembly across five architectures

I've been cobbling together a little collection of architectures as part of my journey to learn how to write a compiler.

@pskocik
pskocik / shellguard.c
Last active September 6, 2019 21:12
Protect against Ctrl+C and Ctrl-/ not hitting processes backgrounded from shellscripts and leaving them running
/*
NAME:
shellguard
Signal forwarding intermediary command executer that translates terminal-generated SIGINT/SIGQUIT (Ctlr+C/Ctrl+/)
into SIGTERM/SIGABRT so that shell-backgrounded procesess don't stay running in the background when
the user presses Ctrl+C or Ctrl+/.
PROBLEM:
Shell scripts don't kill their child processes and instead rely on process-group-wide signals
@Earnestly
Earnestly / c99_ub_list.rst
Last active March 29, 2024 03:52
C99 List of Undefined Behavior (193 Cases)

C99 List of Undefined Behavior

From N1256: (See http://port70.net/~nsz/c/c99/n1256.html#J.2)

  • A "shall" or "shall not" requirement that appears outside of a constraint is violated (clause 4).
  • A nonempty source file does not end in a new-line character which is not immediately preceded by a backslash character or ends in a partial preprocessing token or comment (5.1.1.2).
  • Token concatenation produces a character sequence matching the syntax of a universal character name (5.1.1.2).
  • A program in a hosted environment does not define a function named main using one of the specified forms (5.1.2.2.1).
  • A character not in the basic source character set is encountered in a source file, except in an identifier, a character constant, a string literal, a header name, a comment, or a preprocessing token that is never converted to a token (5.2.1).
  • An identifier, comment, string literal, character constant, or header name contains an invalid multibyte character or does not