Skip to content

Instantly share code, notes, and snippets.

@compnerd
compnerd / reverse-range.cc
Last active December 18, 2015 00:09
An implementation of a reverse iteration adaptor for range based for-loops in C++11.
/* vim: set et ft=cpp.doxygen sts=2 sw=2 ts=8 : */
/**
* Copyright © 2013 Saleem Abdulrasool <compnerd@compnerd.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
#!/usr/bin/zsh
# Copyright © 2013 Saleem Abdulrasool <compnerd@compnerd.org>
# vim: set et ft=sh sts=2 sw=2 ts=8 :
function zle-line-init zle-keymap-select {
RPS1="${${KEYMAP/vicmd/-- NORMAL --}/(main|viins)/-- INSERT --}"
RPS2=${RPS1}
zle reset-prompt
}
@compnerd
compnerd / const-range-adaptor.hh
Last active December 27, 2015 07:09
Adaptor to permit range based iteration via non-conforming begin-expr, end-expr ranges
/* vim: set et ft=cpp.doxygen sts=2 sw=2 ts=8 : */
/**
* Copyright © 2013 Saleem Abdulrasool <compnerd@compnerd.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
/* vim: set et ft=cpp.doxygen sts=2 sw=2 ts=8 : */
/**
* Copyright © 2014 Saleem Abdulrasool <compnerd@compnerd.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
/**
* Copyright © 2015 Saleem Abdulrasool <compnerd@compnerd.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*

Keybase proof

I hereby claim:

  • I am compnerd on github.
  • I am compnerd (https://keybase.io/compnerd) on keybase.
  • I have a public key ASCKqxsHxm82ix4H-JftmvGTX2QK8CVevMnTfwytrWvhrQo

To claim this, I am signing this object:

pushd /image/usr/src/linux-5.13.12
make ARCH=x86_64 mrproper
make ARCH=x86_64 INSTALL_HDR_PATH=/image/usr headers_install
popd
mkdir -p /image/var/tmp/build/compiler-rt-12.0.1
pushd /image/var/tmp/build/compiler-rt-12.0.1
cmake -D CMAKE_BUILD_TYPE=Release \
-D CMAKE_C_COMPILER=clang \
-D CMAKE_C_COMPILER_TARGET=x86_64-unknown-linux-musl \
@compnerd
compnerd / com-interop-design.md
Created April 20, 2026 18:00
COM Interop Design Notes

COM Interoperability Design

This document describes a design for Component Object Model (COM) interoperability in Swift: the @COM attribute, object layout, ARC bridge, QueryInterface implementation, Clang importer integration, threading model, activation, aggregation, and the COM module contents. A companion document (winrt-projection-design.md) covers the WinRT projection layer built on this foundation.

Introduction

The Component Object Model (COM) is the foundational binary interface standard underlying the Windows platform. Every significant Windows API surface, from Win32 shell extensions to Direct3D, from Office automation to the Windows Runtime (WinRT), is defined in terms of COM interfaces. COM is also used cross-platform: Mozilla's XPCOM and Apple's IOKit both implement COM-compatible binary interfaces, and MiniCOM demonstrates that the binary model is genuinely portable, running on Linux, macOS, Android, iOS, and Web