Skip to content

Instantly share code, notes, and snippets.

View vzaliva's full-sized avatar

Vadim Zaliva vzaliva

View GitHub Profile
@fay59
fay59 / Quirks of C.md
Last active January 23, 2024 04:24
Quirks of C

Here's a list of mildly interesting things about the C language that I learned mostly by consuming Clang's ASTs. Although surprises are getting sparser, I might continue to update this document over time.

There are many more mildly interesting features of C++, but the language is literally known for being weird, whereas C is usually considered smaller and simpler, so this is (almost) only about C.

1. Combined type and variable/field declaration, inside a struct scope [https://godbolt.org/g/Rh94Go]

struct foo {
   struct bar {
 int x;
commit ec8f935df189b4857b064768d86591bb035b8783
Author: Jason Gross <jgross@mit.edu>
Date: Thu May 7 16:27:10 2015 -0400
Absolutize all [Import]s
Previously, on case-insensitive file systems, Coq thought that [Require
Import List] meant [Require Import MathClasses.implementations.List]
(which is invalid), not [Require Import Coq.Lists.List]. This fixes
that.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kseo
kseo / recon.ml
Last active March 28, 2024 14:41
A Hindley-Milner type inference implementation in OCaml
#! /usr/bin/env ocamlscript
Ocaml.ocamlflags := ["-thread"];
Ocaml.packs := [ "core" ]
--
open Core.Std
type term =
| Ident of string
| Lambda of string * term
| Apply of term * term