Coding practices are a source of a lot of arguments among programmers. Coding standards, to some degree, help us to put certain questions to bed and resolve stylistic debates. No coding standard makes everyone happy. (And even their existence is sure to make some unhappy.) What follows are the standards we put together on the Core team, which have become the general coding standard for all programming teams on new code development. We’ve tried to balance the need for creating a common, recognizable and readable code base with not unduly burdening the programmer with minor code formatting concerns.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*% cc -o # % | |
* com [-n] [file ...] | |
* looks for the sequence /*% in each file, and sends the rest of the | |
* line off to the shell, after replacing any instances of a `%' character | |
* with the filename, and any instances of `#' with the filename with its | |
* suffix removed. Used to allow information about how to compile a program | |
* to be stored with the program. The -n flag causes com not to | |
* act, but to print out the action it would have taken. | |
*/ | |
#include <string.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ... */ | |
template<size_t Dimen> | |
class NDMatrix | |
{ | |
public: | |
/* this is imaginary, as of right now: */ | |
$for(size_t i = 0; i < Dimen; ++i) { | |
/* Create one function definition for each dimen access: | |
* float &At(int x0, int x1, etc...) { return m_array[_At(...)]; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export PATH=$PATH:$HOME/x86_64-linux-musl/bin | |
export CC=x86_64-linux-musl-gcc | |
export CXX=x86_64-linux-musl-g++ | |
# wget -nc https://zlib.net/zlib-1.2.11.tar.gz | |
# wget -nc ftp://ftp-osl.osuosl.org/pub/libpng/src/libpng16/libpng-1.6.34.tar.xz | |
# wget -nc -O libjpeg.tar.gz http://sourceforge.net/project/showfiles.php?group_id=159521 | |
wget -nc https://github.com/opencv/opencv/archive/3.3.0.zip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
del /s /q build/* | |
rmdir /s /q build | |
mkdir build | |
cd build | |
cmake .. -G"Visual Studio 16 2019" -A x64 -Thost=x64^ | |
-DCMAKE_BUILD_TYPE:STRING="Release"^ | |
-DCMAKE_INSTALL_PREFIX:STRING="output"^ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ROOT=output | |
CC=x86_64-linux-musl-g++ | |
CFLAGS=" | |
-nostdinc | |
-isystem $ROOT/x86_64-linux-musl/include/c++/7.2.0 | |
-isystem $ROOT/x86_64-linux-musl/include/c++/7.2.0/x86_64-linux-musl | |
-isystem $ROOT/x86_64-linux-musl/include/c++/7.2.0/backward | |
-isystem $ROOT/x86_64-linux-musl/include/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
IFS=$'\n\t' | |
VERSION=$(git --version | cut -b13- | sed -n 's/.*[0-9]*\.\([0-9]*\)\.[0-9]*.*/\1/p') | |
if [ "$VERSION" -lt 15 ]; then | |
echo "git version 2.15.0 or higher required" | |
echo "please upgrade your git: brew upgrade git" | |
exit 1 | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# p4.py - p4 offline caching | |
# | |
# Copyright (c) 2017 Arvid Gerstmann | |
# | |
# 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 the Software, and to permit persons to whom the Software is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
auto PtrLiteral = new (S.Context) CXXNullPtrLiteralExpr( | |
S.Context.NullPtrTy, NTTP->getLocation()); | |
Expr *Value = | |
S.ImpCastExprToType(PtrLiteral, NullPtrType, CK_NullToPointer) | |
.get(); | |
DeducedTemplateArgument NewDeduced(S.Context.getCanonicalTemplateName(Arg)); | |
DeducedTemplateArgument Result = checkDeducedTemplateArguments( | |
S.Context, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -*- C++ -*- | |
//===----------------------------- coroutine -----------------------------===// | |
// | |
// The LLVM Compiler Infrastructure | |
// | |
// This file is distributed under the University of Illinois Open Source | |
// License. See LICENSE.TXT for details. | |
// | |
//===----------------------------------------------------------------------===// |