Current mission: finish filling in the OTDs

SNCA:C++

From Soyjak Wiki, the free ensoyclopedia
Jump to navigationJump to search
C++ is ARYAN
btw, if that matters
Don't mention to the C++ developer how bad their language actually is, lest they start leaking

C++🗝️ is a general purpose programming language that is used for all sorts of software, from game development to embedded systems. It is the language of choice for chuds everywhere, although some troonslop such as Touhou Project was written in C++ o algo. It extends the C language with additional concepts and features and has a larger standard library, and it originally began as an extension of C with object oriented programming support. Some similar languages to C++ are Java and Rust (which trannies transheart). Learning it will make you a racist chad. It is literally better than C in every way. It is also somewhat similar to C#, which itself is based on Java and is the language used by a lot of slop game engines such as Unity and Godot. C++ is the language of Unreal Engine and most game development SDKs are C++. Linus Torvalds, the creator of Linux, however, seethed about it, just like he seethed about Java.

It has been used by some Jewish companies such as Microsoft to create coal such as Windows, because it is suited for high-performance applications.

Despite its Aryanity[Nobody says this], Terry Davis has referred to its creator, Bjarne Stroustrup (a Danish and thus Aryan chad), as a nigger. This might just be him seething about the language itself doe (actually bjarne is a nocoder cnile subhuman).

History[edit | edit source]

It was created by a Danish engineer Bjarne Stroustrup who originally wanted to supplement the C language with object-oriented programming, creating "C with Classes". However, it later added several new features. The first standardised release of C++ was C++98, released in 1998. In 2003, another revision addressing problems in C++98 was released, C++03. It can be considered an oldfag language due to inheriting everything from C, and most of its features being bolted on top of C. Despite this, you should not write C++ like you write C, as there is often a "C++-style" way to do something done in C.

Since 2011, C++ has released a new version each three years. The current release is C++23, with the next upcoming release C++26.

Example[edit | edit source]

import std;

using std::mt19937;
using std::random_device;
using std::runtime_error;
using std::uniform_int_distribution;

/**
 * @brief Determines whether the tranny should ack based on a given probability.
 *
 * @param ackProbability An (unsigned) integer between 0 and 100 representing the chance of acking.
 * @return True if the random probability is less than the ackProbability; otherwise, False.
 */
[[nodiscard]]
bool shouldAck(unsigned int ackProbability) noexcept {
    static thread_local mt19937 gen(random_device{}());
    uniform_int_distribution<unsigned int> dist(0, 99);
    return dist(gen) < std::clamp(ackProbability, 0u, 100u);
}

/**
 * @brief Main function that decides whether to ack or scream TRANS RIGHTS ARE HUMAN RIGHTS!!!!!!!! based on probability.
 *
 * @param argc The number of command line arguments.
 * @param argv An array of command line arguments.
 * @return Whether the program executed successfully.
 *
 * @throws std::runtime_error
 */
int main(int argc, char* argv[]) {
    if (shouldAck(41)) {
        throw runtime_error("ACK!!!!"); 
    } else {
        std::println("TRANS RIGHTS ARE HUMAN RIGHTS!!!!!!!!"); 
    }
    return 0;
}

Tutorial[edit | edit source]

The following is a brief tutorial on the functionality of C++. This tutorial assumes you have already read the C tutorial and familiar with the concepts it introduces.

This tutorial assumes the user has C++23 or later, as well as a library supporting import std;. If you don't have access to modules, you can easily find the corresponding documentation about which header to #include on a website like cppreference.com.

This tutorial also further assumes basic familiarity with programming.

Hello World[edit | edit source]

The Hello World program in C++ is as follows:

import std;

int main() {
    std::println("Hello, world!");
}

Here, import std; imports the entirety of the C++ standard library for use into the program. Unlike headers in C, import is purely semantic and handled at compile-time, whereas #include takes the contents of a header and inserts them at the site of inclusion at preprocessing time, which is slower to compile in most cases.

If you're familiar with Java (see the Java tutorial for details), you will notice that in C++, there is no restriction that all code must reside in a class, or a namespace for that matter.

The main function is the same as it is in C. In C++, it must always reside in the global namespace.

Finally, the function println() (from the std namespace) is a function that prints a string to the console, with an appended newline at the end. To avoid appending an extra newline, you can use print() instead. If you recall from the C tutorial, where we used printf(), you may ask why we don't use printf(). This is because C's printf() lacks type safety and is considered less flexible than C++'s print functions.

Variables[edit | edit source]

Variables in C++ work exactly as they do in C.

Also, to bring a class from the standard library into scope, you need to use a using statement, which imports that type from whatever namespace it resides in into the global scope so that it may be referred to without the namespace. You can also use using namespace, which imports all symbols from a namespace, into scope, however this is often discouraged due to often being unpredictable, and often adds unwanted symbols into scope.

When using headers, never put a using statement in a header as this transitively applies to anything that includes the header. However, it's okay to use using statements in modules as modules won't transitively pass using statements unless you explicitly export them.

Also, print functions support formatting. If you're familiar with Python, the syntax is the same.

In C++, there is a string class in the standard library, which is much simpler and versatile to use than the C char* form of strings.

import std;

using std::string;

int main() {
    int age = 18;
    string name = "Nate";
    string website = "soyjak.party";
    std::println("{} is {}, and thus old enough to post on {}!", age, name, website);
}

Reading input[edit | edit source]

There are many ways to read input, whether from a file or from the global input stream. To just read single values from the global input stream, use std::cin and pipe the values into the variables using the >> operator.

import std;

using std::cin;

int main() {
    int a;
    int b;
    std::print("Enter a first number: ");
    cin >> a;
    std::println();
    std::print("Enter a second number: ");
    cin >> b;
    std::println();
    std::println("The sum of the numbers is a + b = {} + {} = {}", a, b, a + b);
}

Meanwhile, if you want to read a full line, use the getline() function:

import std;

using std::cin;
using std::string;

int main() {
    string name;
    std::print("What's your name? ");
    std::getline(cin, name);
    std::println();
    std::println("{}? That's a gemmy name.", name);
}

Range-based for loop[edit | edit source]

Loops in C++ are exactly the same as in C. However, C++ also introduces the "range-based for loop", useful for iterating over an array or a collection. The syntax is for (element : collection) { body }.

import std;

using std::array;

int main() {
    array<int, 5> a = {1, 2, 3, 4, 5};
    for (int x : a) {
        std::println("x = {}", x);
    }
}

Namespaces and modules[edit | edit source]

A namespace is essentially a grouping of things, such as classes, functions, variables, etc. Unlike in Java, you can have as many namespaces inside a file as you want, and a primary benefit of namespaces is that they allow you to declare two things with the same name, as long as they reside in different namespaces.

import std;

namespace soy {
    void postBait() {
        std::println("Trans rights are human rights!");
    }
}

namespace pol {
    void postBait() {
        std::println("Israel is our greatest ally!");
    }
}

You can nest multiple namespaces inside each other:

namespace soy {
    namespace qa {
        // The function is soy::qa::wipeCatty()
        void wipeCatty() {
            std::println("GEEEEEEG, im flooding the catty with low-quality slop");
        }
    }

    namespace pol {
        // The function is soy::pol::trollBrownoids()
        void trollBrownoids() {
            std::println("Quote is racist crackkka who banned us from /soy/ o algo");
        }
    }
}

namespace cuck::lgbt {
    // The function is cuck::lgbt::postBait()
    void postBait() {
        std::println("You will never be a woman!");
    }
}

Meanwhile, a module is a whole file that can be imported. You have strict control over what you want to export from the module as well. In C++, you don't have to separate a module into "interface" and "implementation" like you do in C with header files/source files.

export module soy;

import std;

namespace soy {
    // This function is exported
    export void postBait() {
        std::println("Trans rights are human rights!");
    }

    // This function is not exported
    void postSlopjak() {
        std::println("Good morning saar, here is my newest slopjak");
    }
}

Then, it can be imported like so:

import soy;

int main() {
    soy::postBait(); // Prints "Trans rights are human rights!");

    // soy::postSlopjak();
    // This isn't possible, as soy::postSlopjak() isn't exported from module soy
}

Modules can themselves be broken up into partitions. Partitions can't be imported on their own, but belong to the module they are part of.

export module soyjakparty:Anon;

export namespace soy {
    class Anon {
        // ...
    };
}

It is not enforced, but one good way of organising things is making files, namespaces, modules all match each other (just like in Java).

References[edit | edit source]

In C++, a reference is basically like a pointer in C, with the following caveats:

  • A reference is declared with &, so for any type T, the reference to T is denoted T&.
  • References must be initialised immediately; for example, int& x; is illegal. References must also always point to a valid object, and cannot point to nullptr.
  • References cannot be pointed to another variable.

References are essentially like pointers, that dereference automatically.

They are particularly useful in functions, to avoid copying. Also, if you use a const reference (const T&), it prevents modification and avoids copying. This is usually the most efficient and safe way to do things.

import std;

using std::string;

void greet(const string& name) {
    std::println("Welcome to the sharty, {}, o algo.", name);
}

Classes[edit | edit source]

In C++, a class is basically the same as a C struct, except the fields are by default private. A class defines private, protected and public regions of code, where code inside the different regions have different access:

  • private code can be accessed only by that class. Most fields are usually private.
  • protected code can be accessed only by the class and its descendants (through inheritance).
  • public code can be accessed by anyone. Most things, such as methods, constructors and destructors are public.

It is important to define clear boundaries on what code is public and private, to preserve code encapsulation. This ensures only code that is intended to be able to modify classes may modify classes, while other code is prevented from doing so.

In C++, you no longer have to prefix a class/struct with class or struct to first - for example, what had to be referred to as struct X in C is now tolerated as just X in C++.

A class consists of a constructor, a destructor, methods and fields. The fields consist of the data the class holds, while methods are functions that act on that class.

For a class X, a constructor X() is a special function that is used to create an object. It is named the same as the class, and has no return type. You can have as many different constructors as you like. A destructor ~X(), however, is another special function that is used to destroy (deallocate the memory and release the resources) an object. Like the constructor, it is named the same as the class but prefixed with a tilde (~), and likewise has no return type either, but you can only have one destructor. Destructors never have parameters. Destructors typically are never manually called, but they are automatically called once either the object leaves scope or is manually deleted (explained in dynamic memory allocation).

export module soyjakparty.wiki.examples;

import std;

export namespace soyjakparty::wiki::examples {

class Nusoi {
private:
    string name;
    int numberOfYears;
public:
    Nusoi(const string& name, int numberOfYears):
        name{name}, numberOfYears{numberOfYears} {
        std::println("I'm a nusoi named {} and I've been on the bald men with glasses site for {} years");
    }

    ~Nusoi() {
        std::println("OYYYYY QUOTE DON'T 'NISH ME");
    }

    void participateInRaids() {
        std::println("OYYYY DOCTOS 'ox and 'ape this tranny!!!");
    }

    string getName() {
        return name;
    }

    int getNumberOfYears() {
        return numberOfYears;
    }
};

}

Then, the class can be used like so:

import soyjakparty.wiki.examples;

using soyjakparty::wiki::examples::Nusoi;

int main() {
    Nusoi nate = Nusoi("Nate Higgers", 1);
    nate.participateInRaids();
    int years = nate.getNumberOfYears();
}

Enums[edit | edit source]

In C++, the old C enum is still type-unsafe, but C++ supports a new enum, enum class, which is scoped and type-safe.

enum class Colour {
    RED,
    ORANGE,
    YELLOW,
    GREEN,
    BLUE,
    INDIGO,
    VIOLET
};

enum class Day {
    MONDAY = 1,
    TUESDAY = 2,
    WEDNESDAY = 3,
    THURSDAY = 4,
    FRIDAY = 5,
    SATURDAY = 6,
    SUNDAY = 7
};

Colour colour = Colour::RED;
Day day = Day::WEDNESDAY;

colour = Day::FRIDAY; // Not allowed
day = 15; // Not allowed

Inheritance[edit | edit source]

Classes can extend each other, allowing them to inherit the features of another class. The class that is being inheriting from is called the "base" class while the class that is inheriting is called the "derived" class.

C++ lacks "interfaces" like Java, but it can essentially emulate them using classes whose methods are all pure virtual, called an "abstract class". C++ does not limit the number of base classes a class may extend, unlike languages like Java and C# which limit it to one, but permit implementing any number of interfaces.

The keyword public denotes the access level of inheritance, denoting that a class inherits its base class's features, and can be used in places where its base class is expected. This is the most common form of inheritance used, and is equivalent to the inheritance used in other languages. private inheritance specifies that the class inherits the features of the base class, but cannot be used in place of its base class.

export module soyjakparty.wiki.examples;

import std;

export namespace soyjakparty::wiki::examples {

class Vehicle {
private:
    string brand;
    int year;
public:
    Vehicle(const string& brand, int year):
        brand{brand}, year{year} {}

    virtual ~Vehicle() = default;

    virtual void displayInfo() {
        std::println("Brand: {}, Year: {}", brand, year);
    }
};

class Flyable {
public:
    virtual void fly() = 0;
};

class Drivable {
    virtual void drive() = 0;
};

class Car : public Vehicle, public Drivable {
private:
    int doors;
public:
    Car(const string& brand, int year, int doors):
        Vehicle(brand, year), doors{doors} {}

    ~Car() override = default;

    void drive() override {
        std::println("Driving the car with {} doors.", doors);
    }

    void displayInfo() override {
        std::println("Brand: {}, Year: {}, Doors: {}", brand, year, doors);
    }
};

class Airplane : public Vehicle, public Flyable {
private:
    int maxAltitude;
public:
    Airplane(const string& brand, int year, int maxAltitude):
        Vehicle(brand, year), maxAltitude{maxAltitude} {}

    ~Airplane() override = default;

    void fly() override {
        std::println("Flying the airplane at max altitude of {} metres.", maxAltitude);
    }

    void displayInfo() override {
        std::println("Brand: {}, Year: {}, Max altitude: {}", brand, year, maxAltitude);
    }
};

}

In use:

import soyjakparty.wiki.examples;

using soyjakparty::wiki::examples::Airplane;
using soyjakparty::wiki::examples::Car;

int main() {
    // Use in-place initialisation instead
    Car car("Toyota", 2022, 4);
    Airplane airplane("Boeing", 2020, 35000);

    car.displayInfo();
    car.drive();

    airplane.displayInfo();
    airplane.fly();
}

Dynamic memory allocation[edit | edit source]

Using dynamic memory allocation, we can allocate memory for objects at runtime rather than at compile time. This declares the object in heap memory, rather than stack memory. Unlike Java, where all objects must be on the heap while primitives are on the stack, in C++ there is no such restriction; anything can be placed anywhere. This is often useful in situations where behaviour must depend on runtime information, such as user-provided information.

In C++, instead of C's malloc() and free() functions, we use the new and delete keywords. These are much better, as they don't require you to directly specify the size of the allocation.

To declare an object on the heap, use the new operator. This allocates a piece of heap memory for that object, and returns a pointer to that object. However, once you are done with that object you must de-allocate it with the delete operator. Failure to do so will result in the program leaking memory, which is a serious bug if the program continues to run for extended periods of time.

Consider the previous vehicle example again. Then, if using dynamic memory allocation:

import soyjakparty.wiki.examples;

using soyjakparty::wiki::examples::Airplane;
using soyjakparty::wiki::examples::Car;

int main() {
    // Use in-place initialisation instead
    Car* car = new Car("Toyota", 2022, 4);
    Airplane* airplane = new Airplane("Boeing", 2020, 35000);

    car.displayInfo();
    car.drive();

    airplane.displayInfo();
    airplane.fly();

    delete car;
    delete airplane;
}

One way to avoid leaking memory is by using smart pointers. Two of the most important smart pointers are:

  • unique_ptr<T>: a pointer that uniquely owns the object that it points to. Once this pointer goes out of scope, the object is disposed of. It is often created using a function make_unique().
  • shared_ptr<T>: a pointer that shares the object that it points to. It counts the number of references pointing to that object, and once that count reaches 0, it automatically disposes of the object. It is often created using a function make_shared().
import std;
import soyjakparty.wiki.examples;

using std::unique_ptr;

using soyjakparty::wiki::examples::Airplane;
using soyjakparty::wiki::examples::Car;

int main() {
    unique_ptr<Car> car = std::make_unique<Car>("Toyota", 2022, 4);
    unique_ptr<Airplane> airplane = std::make_unique<Airplane>("Boeing", 2020, 35000);

    car.displayInfo();
    car.drive();

    airplane.displayInfo();
    airplane.fly();
}

Exceptions[edit | edit source]

In C++, if you want to indicate an error, you can throw an exception. This is done with the throw keyword. When an exception is thrown, it travels up the call stack, and if it remains uncaught once it passes main(), then the program crashes. If you want to try some operations which may throw an exception, use the try block, and when an exception is thrown, the catch block will be used to catch the exception. It is best recommended to catch exceptions by const reference.

  • catch (const NusoiException& e) catches any exception that is of type NusoiException.
  • catch (const exception& e) catches any exception that is has exception as a base class.
  • catch (const E& e) catches any object that is an E. In C++, any object, even non-exception types, can be thrown.
  • catch (...) catches any thrown object, regardless of type.

The standard library provides various exception types. These include:

  • exception: the usual base class for an exception.
  • logic_error: represents a logic error in programming.
  • runtime_error: represents an error that happens at runtime.
  • invalid_argument: represents an error when an argument is not accepted.
  • domain_error: represents an error when an input may be outside a domain of defined operation.
  • length_error: represents an error when something exceeds an implementation-defined length.
  • out_of_range: represents an error when something tries to access an element of a collection (such as a string or vector) beyond its valid range of indexes.
  • overflow_error: represents an arithmetic overflow error.
  • underflow_error: represents an arithmetic underflow error.
  • system_error: represents an error when something with operating system facilities fails.

These exceptions all have a method what() that gives the error message associated with the exception.

import std;

using std::cerr;
using std::exception;
using std::runtime_error;
using std::string;

class NusoiException: public runtime_error {
    explicit NusoiException(const string& message):
        runtime_error(message) {}
};

class Nusoi {
    // The implementation from earlier

    void doxThisTarget(const string& targetName) {
        if (targetName == this->name) {
            throw NusoiException("OYYYY i can't 'ox this target, that's me!");
        } else {
            std::println("Hey /raid/, let's all 'ox this target!");
        }
    }
};

int main() {
    try {
        Nusoi nate("Nate Higgers", 1);
        nate.participateInRaids();
        nate.doxThisTarget("Troonella Ackermann");
        nate.doxThisTarget("Nate Higgers"); // throws
    } catch (const NusoiException& e) {
        std::println(cerr, "Caught NusoiException: {}", e.what());
    } catch (const exception& e) {
        std::println(cerr, "Caught exception: {}", e.what());
    } catch (...) {
        std::println(cerr, "Caught an unknown exception.");
    }
}

Templates[edit | edit source]

In C++, a template allows you to specialise a function or class for a different type without having to manually create overloads.

template <typename T>
T max(T a, T b) {
    return a > b ? a : b;
}

template <typename T>
class LinkedList {
private:
    T current;
    LinkedList<T>* next;
public:
    LinkedList(T current, LinkedList<T>* next = nullptr):
        current{current}, next{next} {}

    T getCurrent() {
        return current;
    }

    LinkedList<T>* getRest() {
        return next;
    }
};

By using concepts, templates can be constrained to satisfy conditions.

import std;

using std::same_as;
using std::floating_point;

template <typename T>
concept Drawable = requires (T t) {
    { t.draw() } -> same_as<void>; // T::draw must return void
    { t.area() } -> floating_point; // matches any floating-point type
};

// The class Circle satisfies the Drawable concept
// Circle does not need to declare it satisfies Drawable, however
class Circle {
private:
    const double radius;
public:
    explicit Circle(double r):
        radius{r} {}

    void draw() const {
        // draw a circle...
    }

    double area() const noexcept {
        return std::numbers::pi * radius * radius;
    }
};

// Only types which satisfy Drawable may be used
template <Drawable T>
void render(const T& shape) {
    // ...
    shape.draw();
    std::println("Drew shape with area {}", shape.area());
}

Standard library types[edit | edit source]

The C++ standard library contains many useful classes, all within the std namespace.

General use[edit | edit source]

Some of the most fundamental or universally usable classes include:

  • any is a class which may store any type. It is basically a type-erased container.
  • optional<T> represents either an object (of type T) or an absence of the object. If there is nothing in optional, its value is nullopt.
  • expected<T, E> represents either an object (of type T) or an error type (of type E).
  • pair<T, U> is a type representing a pair of objects, one of type T and the other of type U.
  • tuple<Ts...> is a type representing a tuple, which can hold an indefinite number of objects of any type.
  • variant<Ts...> is a type representing a type-safe union, which can contain one of several types.

Arrays and collections[edit | edit source]

C++ features various collection (container) types. Some of the most important ones are:

  • array<T, N> is an array of length N storing objects of type T. The length N is fixed and must be specified at compile-time. It is essentially a wrapper over the C array T[], providing object-oriented features.
  • vector<T> is essentially a dynamic array storing objects of type T. Objects can be freely inserted and removed from the vector.
  • unordered_map<K, V> is a dictionary-like type storing keys of type K, and mapping them to objects of type V.
  • span<T> represents a non-owning view over piece of contiguous memory, such as an array.

There are more, but they aren't particularly worth talking about (yet).


Memory and type safety improvements[edit | edit source]

THIS TOPIC ATTRACTS ASPIES
Please remind those obsessed with this SNCA to breathe deeply from the toilet bowl.
WARNING: WORDSWORDSWORDS This page or section is a wall of text!
(You) VVILL add images and make the text less dense.

C++ solves a lot of memory issues that C originally had.

  • C++ has RAII (or "Resource Acquisition is Initialization"), which is a pattern that automatically releases resources once they go out of scope. In C you would have to call ::free(), but in C++ an object automatically calls delete on itself once it goes out of scope (unless it's a pointer o algo).
  • If you were using pointers, you could use smart pointers which do the same thing but for pointers.
  • C++ introduces scoped enums with enum class, over C enum.
  • Collection types such as std::vector offer bounds checking with .at() and automatically resize themselves (meaning you don't have to use ::realloc() like you would to resize an array in C). You can also use std::array<T, N> instead of T[N] which is safer and more idiomatic or something.
  • C++ has a built in std::string type instead of relying on char[] for strings (which is a bare minimum for most languages nowadays), and ensures that a raw block of memory doesn't get used as a string.
  • C++ adds copy and move semantics.
  • C++ decreases reliance on the preprocessor, which is heavily used by C but is much less type safe due to performing literal text substitution:
    • Instead of using #define to define macro constants, you can use constexpr to define constants and functions known at compile time, which don't occupy any memory at runtime but remains type safe. This feature was so gemmy it was backported to C23. It is like a stronger version of const.
    • Instead of using #define to define functions or bypass function call stack overhead, you can use inline to tell the compiler to substitute the function body.
    • To avoid recompiling translation units multiple times which occurs when you #include header files, you can use modular translation units and import them so they are only compiled once and do not require include guards.
  • Instead of using void* (void pointers) to write generic code, you can use templates to make generic code. You can restrict templates using concepts for increased safety as well.
  • C++ has easier error handling: you can throw exceptions or return std::expected<T, E> (omg just like rust sisters!!!), unlike in C which relies on return codes. In C++ you can use try/catch blocks to do cleanup upon errors.

Criticism[edit | edit source]

Bjarne Stroustrup and the C++ committee are trans btw, if that matters.
> Now, there was a nigger, who came up with this: std::cout << "Hello, world!" << std::endl and that's pretty niggerlicious. <
Terry Davis


We have more in common than previously thought!

Despite its aryanity there are a lot of things that make C++ bad.

  • Poorly designed standard library that includes a lot of random features picked up over the years.
    • C++ doesn't separate its standard library into namespaces like every other language, so everything gets dumped in to the std namespace
    • A lot of features that no one asks for get added to the language but important features like networking, process management, or an improved OS API never get added meaning you have to use some external library like Boost. So you basically have to use some shitty library maintained by a 'cord troon implying the standard library isnt shitty itself, but at least in Rust it's easy to that whereas in C++ it's a pain in the arse.
    • The features that get added to C++ are either dead on arrival because they were designed by a sub-80 IQ drooling retard or no one cares about the feature, or compilers take forever actually implementing the feature (for example modules).
    • Minecraft Bedrock edition is buggy as shit
    • C++ names all its symbols in snake_case, even classes and constants. For example instead of UniformIntDistribution like most languages would name it, in C++ it is uniform_int_distribution.
    • The standard library is distributed through headers and not modules, and in order to prevent distortion of symbol names by the preprocessor (because headers are processed by the preprocessor while modules are not), all symbols in the standard library are suffixed with underscores and random capital letters resulting in goofy aah skibidi yapping error messages in Ohio. No other language has this problem (except maybe C), because no other language still uses headers geg.
  • Extremely niggerlicious error messages that no one can read, especially from any code involving templates.
  • using is avoided like the plague in C++, though for no good reason. The usual story you hear is using namespace std; is for plebs or something, but this is pretty retarded reasoning. Could you imagine writing Java with no import statements or C# with no using statements? That's pretty much the same thing but I guess C++niggers put up with it because writing std:: is five extra characters and once again they dumped everything into that namespace.
  • Unlike Rust which has a very simple and official build system, cargo, C++ has no official build system which means you have to use something like CMake which is a scripting language for configuring your build system. Also CMake is a build system generator, not a build system. This means you have to use CMake to generate the actual build system (like Make or Ninja), which is usually extremely verbose and difficult to manually write yourself.
  • Including third party libraries is extremely difficult. Unlike Rust which has repositories like crates.io, in C++ there are no official package managers or repositories to get stuff from so you have to either use microshit jeetslop like vcpkg which doesn't even work or conan which is also a pain in the ass to set up. Or you can use CMake FetchContent which also sucks nigger bbc geeeeeeeeg. Or you can literally just copy header files in to your include directory like a troglodyte.
  • C++ is not officially distributed, it is actually standardized by a committee which consists mostly of nocoder boomer trannies who suggest features and vote them in to the language. This also doesn't mean that there is an official C++ release, it means compilers have to implement their shitty specification and they often never finish. For example GCC and Clang still have features from C++17 that are unimplemented.
    • The committee, being run like a tranny anarchist committee that never decides on anything just like the CHAZ from the BLM protests in 2020, never passes any features and C++ basically only gets two or three new features every three years, unlike Java which gets huge updates twice a year.

Gallery[edit | edit source]

C++ is part of a series on Computing

➜ /languages

├ /markup/ HTMLCSSXML
├ /low_level/ AssemblyCC++C#Holy CRust
├ /high_level/ JavaGoPHPPythonSQLBashJavaScriptPowerShellActionScriptScratchRubyLuaP
└ /tutorials/ CC++Java

➜ /software

├ /imageboards/ nusoiVichanYotsubaOpenYotsuba
├ /operating_systems/ WindowsLinuxAndroidTempleOSBSD
├ /applications/ Web BrowserPhotoshopFlashMS PaintIRC
├ /dev/ Free-software licenseGame development
└ /misc/ BabybotMcChallengeCAPTCHASystemdRAIDRicing4getSnarkysnappydoxingtool.batJS Paint

➜ /cyb

➜ /misc

├ /file_formats/ GIFMIDISVGWEBMWEBP
└ /hardware/ ThinkPadChromebooks

➜ /ai

SOYNY