Skip to content

Instantly share code, notes, and snippets.

View johnmcfarlane's full-sized avatar

John McFarlane johnmcfarlane

View GitHub Profile
@johnmcfarlane
johnmcfarlane / wwf_lexicon.cpp
Created December 9, 2019 08:07
Scrabble-like lexicon hard-coded in C++ as a DAWG
This file has been truncated, but you can view the full file.
#include "wwf_lexicon.h"
namespace {
node nAAHED = {
"",
nullptr,
true
};
node nAAHEe[] {nAAHED};
node nAAHE = {
"D",
@johnmcfarlane
johnmcfarlane / pre-cologne numeric TS thoughts.md
Last active July 13, 2019 16:20
Response to inquiry by WG21/LEWG-I chair about the state of the Numeric TS

Where I Think We Are With a Numeric TS

  • This is in answer to Bryce's question about how we should be working towards a Numeric TS.
  • It's my (John McF's) frank and personal opinion about the bits I care about.
  • Written a day before the Cologne 2019 meeting.

Current situation

I interpreted from Kona LEWG-I minutes that we're still exploring the design space. Specific work done by me for Cologne:

@johnmcfarlane
johnmcfarlane / preprocessor_killjoy.h
Created May 22, 2019 13:30
What happened when I added preprocessor_fun.h to a modern, tooled-up C++ project.
// Out of curiosity I took preprocessor_fun.h
// https://gist.github.com/aras-p/6224951
// and added it to a project at work to see what happens when random C
// preprocessor hacks are applied to a modern C++ project with CI.
// Unfortunately, about half were flagged as warnings/errors by the compiler.
// Almost all of the rest had no effect because the codebase uses too much
// of the Standard Library / just doesn't use those APIs.
// The only one which wasn't caught by static tools was __builtin_expect
// which showed up as a failed death test. It is used in <gsl/gsl_assert> so
// should cause a decent amount of consternation in GSL-dependent projects.
// Copyright John McFarlane 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file ../LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// mechanically retrieved, single-header version of CNL library
// https://github.com/johnmcfarlane/cnl
#if ! defined(CNL_COMPLETE_H)
@johnmcfarlane
johnmcfarlane / DoxyPress-installation-woes.md
Created April 22, 2019 11:22
Some observations about one attempt to install DoxyPress on Linux

Tested on Ubuntu 18.10

  1. Cloned copperspice/doxypress

  2. README has no instructions on how to build and instead sends me to DoxyPress docs: https://www.copperspice.com/docs/doxypress/build-doxypress.html

    • Six major dependencies are presented

      • They don't differentiate between DoxyPress and DoxyPressApp
  • #5 claims that I need automake or CMake. This doesn't appear to be the case (*).
@johnmcfarlane
johnmcfarlane / cnl2.h
Created April 17, 2019 21:57
number<> & pals
#include <functional>
#include <type_traits>
#include <utility>
namespace cnl2 {
////////////////////////////////////////////////////////////////////////////////
// Arithmetic - is a something that supports arithmetic operators
//
// As well as a fundamental arithmetic type (unsigned short int, __int128, etc.)
// a class-based type (a pack<> or a number<> instantiation) although bool is
@johnmcfarlane
johnmcfarlane / cnl_complete_17_128bit.h
Last active May 13, 2019 00:22
Single-header CNL library for C++17 with 128-bit integer support
// Copyright John McFarlane 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file ../LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// mechanically retrieved, single-header version of CNL library
// https://github.com/johnmcfarlane/cnl
#if ! defined(CNL_COMPLETE_H)
/*
The MIT License (MIT)
Copyright (c) 2014-2019 Hana Dusíková (hanicka@hanicka.net)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// it's probably a good thing that CompilerExplorer's #include<https://> feature isn't recursive!
@johnmcfarlane
johnmcfarlane / The_Quest_for_Embedded_C++.md
Last active February 21, 2023 18:36
Links related to problems embedded ppl have with C++ and the things we're doing to fix that

The Quest for Embedded C++

There are many problems with C++ and the embedded community which mean they don't get along so well. Here are some resources that might help explain the problems and their solutions.

The Problem