h - Move left
j - Move down
k - Move up
l - Move right
$ - Move to end of line
0 - Move to beginning of line (including whitespace)
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdlib.h> | |
/* | |
This program tests the performance characteristics of write combining | |
On an intel CPU only 4 writes at a time will be combined so we should see | |
a big performance improvement if we only write to distinct memory locations | |
<=4 times per iteration of a loop |
mat4 translate(vec3 d) | |
{ | |
return mat4(1, 0, 0, d.x, | |
0, 1, 0, d.y, | |
0, 0, 1, d.z, | |
0, 0, 0, 1); | |
} | |
mat4 scale(float c) | |
{ |
template<bool> struct _compile_time_assert; | |
template<> struct _compile_time_assert<true> {}; | |
#define ctassert(expr) if (0) { int flaming_goat_sausage = sizeof(_compile_time_assert<(bool)(expr)>); flaming_goat_sausage++; } | |
int main (int argc, char *argv[]) { | |
ctassert (sizeof (int) == 4); | |
ctassert ((sizeof (int) == 5) == false); | |
//BLAM | |
ctassert (sizeof (int) == 5); |
try: | |
from subprocess import DEVNULL # Python 3. | |
except ImportError: | |
DEVNULL = open(os.devnull, 'wb') | |
def start_subprocess(cmd): | |
"""Run cmd (a list of strings) and return a Popen instance.""" | |
return subprocess.Popen(cmd, stdout=DEVNULL, stderr=DEVNULL) |
For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.
After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft
• 5ffd57393a85553ab55b
• 5cd28e2a812e5c65c9f7320e0726da18
• b6a6676a84b51c8200d0673a5b4a87c5
The quotes on this page come from this deleted question on Stackoverflow:
Learning Rust
The following is a list of resources for learning Rust as well as tips and tricks for learning the language faster.
Warning
Rust is not C or C++ so the way your accustomed to do things in those languages might not work in Rust. The best way to learn Rust is to embrace its best practices and see where that takes you.
The generally recommended path is to start by reading the books, and doing small coding exercises until the rules around borrow checking become intuitive. Once this happens, then you can expand to more real world projects. If you find yourself struggling hard with the borrow checker, seek help. It very well could be that you're trying to solve your problem in a way that goes against how Rust wants you to work.