Skip to content

Instantly share code, notes, and snippets.

View worblehat's full-sized avatar

Tobias Marquardt worblehat

View GitHub Profile

C lifetime and ownership documentation

Goals

  • Provide a guide for how and when to document lifetime and ownership in C
  • Prevent bugs caused by wrong assumptions of API users
  • Prevent having to read and understand the whole library code when the API user notices the lack of documentation.
  • Make it more likely that library developers notice a change lifetime requirements. They should check if the documentation is still correct after their change.

Non-Goals

@paulzhol
paulzhol / main.go
Last active April 15, 2023 08:34
golang.org/x/sys/unix.Signalfd usage example (Linux)
// +build linux
package main
import (
"flag"
"log"
"os"
"runtime"
"time"
@davidzchen
davidzchen / SampleLlvm.c
Last active November 24, 2023 18:19
Sample C code using the LLVM coding style
/* Sample file using the LLVM coding standard
http://llvm.org/docs/CodingStandards.html
General rules:
- Indents are two spaces. No tabs should be used anywhere.
- Each line must be at most 80 characters long.
- Use C-style comments when writing C code
- File names should be PascalCase.c
@gerardorochin
gerardorochin / error-install-grub.sh
Last active March 5, 2024 04:49
Fix error generated on the install GRUB on Arch Linux: Syntax errors are detected in generated GRUB config file.
# try:
grub-mkconfig -o /boot/grub/grub.cfg
# output error:
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux-ck
Found initrd image: /boot/initramfs-linux-ck.img
Found Windows 8 (loader) on /dev/sda1
error: out of memory.
error: syntax error.
@dashed
dashed / github-pandoc.css
Created September 26, 2013 13:42
GitHub-like CSS for pandoc standalone HTML files (perfect for HTML5 output). Based on Marked.app's GitHub CSS. Added normalize.css (v2.1.3) in the prior to GitHub css.
/*! normalize.css v2.1.3 | MIT License | git.io/normalize */
/* ==========================================================================
HTML5 display definitions
========================================================================== */
/**
* Correct `block` display not defined in IE 8/9.
*/
@ilyabo
ilyabo / index.html
Created November 17, 2011 14:29
D3 tooltip using jQuery tipsy
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="jquery.tipsy.js"></script>
<link href="tipsy.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="chart"></div>