Skip to content

Instantly share code, notes, and snippets.

View johnmcfarlane's full-sized avatar

John McFarlane johnmcfarlane

View GitHub Profile
@johnmcfarlane
johnmcfarlane / full-output-of-generate.sh.txt
Created June 6, 2020 09:39
Output of document generation script as part of Sphinx bug report #2
# Sphinx version: 3.1.0+
# Python version: 3.8.2 (CPython)
# Docutils version: 0.16 release
# Jinja2 version: 2.11.2
# Last messages:
# reading sources... [ 40%] file/wide__tag_2is__same__tag__family_8h
# reading sources... [ 41%] file/wide__tag_2overloads_8h
# reading sources... [ 41%] file/wide__tag_8h
# reading sources... [ 41%] file/width_8h
# reading sources... [ 41%] file/wrap_8h
@johnmcfarlane
johnmcfarlane / write-a-README.md
Created June 5, 2020 15:22
How to write a README

How to Write a README

Different people have different views about what constitutes a good README document for a software project. I think it should be vehicle for delivery of the bare minimum knowledge necessary to convey why someone might want to use it and how.

Imagine you're a trainee who was given a URL to the GitHub page on your first day. You have only the bare resources needed to run the program, but none of the knowledge about it.

What information would you need? Make certain to add that information:

  • Brief description of project aimed at somebody who might need it, but hasn't necessarily ever heard of it.
  • Link to the projects's home. This might be a github.io site, a Confluence page or a wiki.
@johnmcfarlane
johnmcfarlane / full-output-of-generate.sh.txt
Created June 1, 2020 13:59
Output of document generation script as part of bug Sphinx bug report
--2020-06-01 14:46:28-- http://upload.cppreference.com/mwiki/images/f/f8/cppreference-doxygen-web.tag.xml
Resolving upload.cppreference.com (upload.cppreference.com)... 2604:4f00::3:0:1238:1, 74.114.90.46
Connecting to upload.cppreference.com (upload.cppreference.com)|2604:4f00::3:0:1238:1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1100140 (1.0M) [application/xml]
Saving to: ‘cppreference-doxygen-web.tag.xml’
cppreference-doxygen-web.tag.xml 100%[=====================================================================================================================>] 1.05M 853KB/s in 1.3s
2020-06-01 14:46:30 (853 KB/s) - ‘cppreference-doxygen-web.tag.xml’ saved [1100140/1100140]
@johnmcfarlane
johnmcfarlane / What compiler and language is this?.cpp
Created May 2, 2020 10:02
Script for printing compiler version and language revision as a diagnostic
template <int c, long s> struct _;
#if defined(__clang__)
_<__clang_major__, __cplusplus> clang_version_and_standard;
#elif defined(__GNUC__)
_<__GNUC__, __cplusplus> gcc_version_and_standard;
#elif defined(_MSC_VER)
_<_MSC_VER, __cplusplus> msvc_version_and_standard;
#else
#error "I don't know that compiler"
#endif
@johnmcfarlane
johnmcfarlane / integer-3770d0.cpp
Last active April 18, 2020 12:38
Preprocessed source, /tmp/integer-3770d0.cpp, associated with clang frontend crash
This file has been truncated, but you can view the full file.
# 1 "<built-in>"
# 1 "/home/john/ws/rounding-overflow/cnl/test/unit/scaled_integer/rounding/elastic/integer.cpp"
// Copyright John McFarlane 2015 - 2016.
// 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)
#if 0 /* expanded by -frewrite-includes */
#include <cnl/elastic_integer.h>
@johnmcfarlane
johnmcfarlane / msan-build.sh
Created February 14, 2020 21:58
Script for building MSan
set -exu pipeline
SCRIPT_DIR=$(cd "$(dirname "$0")"; pwd)
PROJECT_DIR="$SCRIPT_DIR"/llvm-project
mkdir -p build
cd build
cmake \
-GNinja \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
@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)