Reference

Programming languages

Choose TypeScript, Go, Rust or C++ and find syntax, everyday APIs, standard libraries and tools in one place.

Scope and conventions

TypeScript/Node, Go 1.23+, Rust 2024 and C++23: from a first CLI to files, JSON, HTTP, concurrency and testing. Complete programs are labeled; other examples identify their surrounding code/imports. Optional libraries and version requirements are named in each entry.

Files & dependencies

Read imports and qualified names

C++

#include supplies header declarations. std:: qualifies a standard-library name. Include each facility’s header; a namespace is not an imported package.

Fragment

Complete main.cpp.

main.cpp
Follow appearance
GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
#include <iostream>
#include <string>

int main() {
    std::string name = "north";
    std::cout << name;
}

Read public and private boundaries

C++

public/private/protected control class member access. Headers expose declarations through inclusion; a namespace alone is not a privacy boundary. An unnamed namespace gives internal linkage to suitable names in a translation unit.

Fragment

Fragment: imports and type/function declarations at file scope; usage statements inside a function.

main.cpp
Follow appearance
GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
class Place {
public:
    int count() const {
        return count_;
    }

private:
    int count_ = 0;
};

Split code across local files

C++

A header commonly declares an API while a .cpp defines it. The build must compile/link the required translation units; #include does not automatically compile a .cpp dependency. This example uses the header workflow, not C++20 modules.

Fragment

Two file fragments; compile/link names.cpp with the caller. #pragma once is widely supported, non-standard.

main.cpp
Follow appearance
GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
// names.hpp
#pragma once
const char* name();

// names.cpp
#include "names.hpp"

const char* name() {
    return "north";
}

Recognize manifests and compiler configuration

C++

C++ has no single mandatory project manifest. A project may use CMake or another build system. This CMake example selects a target and language level; compiler/library support still determines which features work.

Fragment

CMake configuration, not C++ source. CMake 3.20 recognizes cxx_std_23.

main.cpp
Follow appearance
GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
# CMakeLists.txt
cmake_minimum_required(VERSION 3.20)
project(guide LANGUAGES CXX)

add_executable(guide main.cpp)
target_compile_features(guide PRIVATE cxx_std_23)

Recognize dependency commands

C++

Standard headers come from the C++ toolchain. Third-party dependencies follow the project’s package manager and build system; there is no universal C++ install command. Including a header and linking a library are separate concerns.

Fragment

Header recognition fragment. No particular third-party package manager is assumed.

main.cpp
Follow appearance
GitHub Light
GitHub Dark
Rosé Pine
Catppuccin Mocha
VS Code Dark+
#include <vector> // standard library

// Third-party headers/libraries:
// follow this project's build/package files.