Skip to content

Instantly share code, notes, and snippets.

View johnmcfarlane's full-sized avatar

John McFarlane johnmcfarlane

View GitHub Profile
@johnmcfarlane
johnmcfarlane / debug.txt
Created August 27, 2017 17:57
One of many uncrustify failures found using unformat project.
# Uncrustify-0.65-153-37c30cf5
newlines = lf
output_tab_size = 17
string_replace_tab_chars = true
sp_assign = remove
sp_compare = force
sp_paren_paren = force
sp_after_ptr_star = force
sp_ptr_star_paren = remove
sp_before_byref_func = add

(Line 1) Line with double space
(Line 2) Line with backslash
(Line 3) Line without either (Line 4) and continuation of previous line

@johnmcfarlane
johnmcfarlane / constant.md
Last active October 13, 2017 20:03
Draft proposal for addition of `std::constant`

Document number: DXXXXR0
Date: 2017-09-19
Reply-to: John McFarlane, cnl@john.mcfarlane.name
Reply-to: Louis Dionne, ldionne.2@gmail.com
Audience: SG6, SG14, LEWG

General-Purpose Constant Value Type

Introduction

@johnmcfarlane
johnmcfarlane / cnl_complete_int128.h
Last active February 9, 2018 06:05
A single-header C++17 version of CNL library with 128-bit integer support. (Only works on some platforms.)
// Copyright John McFarlane 2017.
// 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 / Commonmark_Edits.md
Created February 20, 2018 23:50
very brief demo of document edit marks (suitable for WG21 papers) in a commonmark document
<style type="text/css"> del {color:red;} ins {color:green;} </style>

Commonmark Edits

Commonmark has noHTML block-provided support for edits.

@johnmcfarlane
johnmcfarlane / cnl_complete_11.h
Last active March 29, 2018 16:52
single-header versions of the CNL library
// Copyright John McFarlane 2017.
// 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 / date.h
Created April 6, 2018 05:05
Taken from Howard Hinnant's Wandbox link
#ifndef DATE_H
#define DATE_H
// The MIT License (MIT)
//
// Copyright (c) 2015, 2016, 2017 Howard Hinnant
// Copyright (c) 2016 Adrian Colomitchi
// Copyright (c) 2017 Florian Dang
// Copyright (c) 2017 Paul Thompson
//
// 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)
// 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 / warning_level_test.cpp
Created August 28, 2018 12:42
code to test warning level of C++ translation unit
// code to test warning level of C++ translation unit;
// works with compilers which support `-Wpedantic` flag
// any warning level: 'extern' variable has an initializer [-Wextern-initializer]
// -Wall: "unused variable 'n' [-Wunused-variable]"
// -Wextra: "missing field 'b' initializer [-Wmissing-field-initializers]"
extern struct { int a, b; } n = {sizeof(void(*)(int))};
// -Wpedantic: "variable length arrays are a C99 feature [-Wvla-extension]"
int evoke_pedantic_warning_vla(int n) { int a[n]; return a[3]; }