Skip to content

Instantly share code, notes, and snippets.

View furkanonder's full-sized avatar
🎯
Focusing

Furkan Onder furkanonder

🎯
Focusing
View GitHub Profile
@furkanonder
furkanonder / Quirks of C.md
Created February 16, 2023 14:58 — forked from fay59/Quirks of C.md
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;
@furkanonder
furkanonder / custom_shelve.py
Created November 17, 2022 15:24
Just a basic modification for support custom pickler and unpickler for shelve module
"""Manage shelves of pickled objects.
A "shelf" is a persistent, dictionary-like object. The difference
with dbm databases is that the values (not the keys!) in a shelf can
be essentially arbitrary Python objects -- anything that the "pickle"
module can handle. This includes most class instances, recursive data
types, and objects containing lots of shared sub-objects. The keys
are ordinary strings.
To summarize the interface (key is a string, data is an arbitrary