+10
.clang-format
+10
.clang-format
+17
Makefile
+17
Makefile
···
1
+
.POSIX:
2
+
3
+
CXX=clang++
4
+
CXXFLAGS=-Wall -Werror -Wextra
5
+
SRC=src/main.cpp
6
+
BUILD=build
7
+
8
+
build: src/main.cpp
9
+
$(CXX) $(SRC) -o $(BUILD)/a.out $(CXXFLAGS)
10
+
11
+
run: build
12
+
./$(BUILD)/a.out
13
+
14
+
format:
15
+
clang-format -i $(SRC)
16
+
17
+
.PHONY: build run format
build/a.out
build/a.out
This is a binary file and will not be displayed.
+17
src/main.cpp
+17
src/main.cpp
···
1
+
/* ========================================================================
2
+
*
3
+
* Filename: main.cpp
4
+
* Description: Prelude testing file
5
+
* Author: Diego A. Estrada Rivera
6
+
* Version: 0.0.1
7
+
*
8
+
* ======================================================================== */
9
+
#include <iostream>
10
+
#include "prelude.hpp"
11
+
12
+
proc main() noexcept -> I32
13
+
{
14
+
std::cout << "Hello world!\n";
15
+
return 0;
16
+
}
17
+
+68
src/prelude.hpp
+68
src/prelude.hpp
···
1
+
/* ========================================================================
2
+
*
3
+
* Filename: prelude.hpp
4
+
* Description: C++ sensible prelude
5
+
* Author: Diego A. Estrada Rivera
6
+
* Version: 0.0.1
7
+
*
8
+
* ======================================================================== */
9
+
#pragma once
10
+
11
+
/* Use sensible numberic types */
12
+
#include <cstdint>
13
+
14
+
using Size = std::size_t;
15
+
16
+
typedef float F32;
17
+
typedef double F64;
18
+
19
+
typedef uint8_t U8;
20
+
typedef uint16_t U16;
21
+
typedef uint32_t U32;
22
+
typedef uint64_t U64;
23
+
24
+
typedef int8_t I8;
25
+
typedef int16_t I16;
26
+
typedef int32_t I32;
27
+
typedef int64_t I64;
28
+
29
+
typedef bool Bool;
30
+
31
+
/* use sensible keywords */
32
+
#define let auto const
33
+
#define var auto
34
+
#define fn [[nodiscard]] auto constexpr
35
+
#define proc [[nodiscard]] auto
36
+
37
+
/* Apparently this isn't included in <tuple>
38
+
* https://en.cppreference.com/w/cpp/utility/tuple/ignore
39
+
*/
40
+
namespace detail {
41
+
struct ignore_t {
42
+
template <typename T>
43
+
constexpr // required since C++14
44
+
void operator = (T&&) const noexcept {}
45
+
};
46
+
}
47
+
inline constexpr detail::ignore_t ignore; // 'const' only until C++17
48
+
49
+
/* use sensible tuple managing functions */
50
+
#define fst std::get<0>
51
+
#define snd std::get<1>
52
+
#define thr std::get<2>
53
+
54
+
/* use sensible data typing */
55
+
template <typename T>
56
+
using Ref = T&;
57
+
58
+
template <typename T>
59
+
using Ptr = T*;
60
+
61
+
/* Unit type */
62
+
enum class Unit {
63
+
unit
64
+
};
65
+
66
+
/* Void type }:) */
67
+
enum class Void {
68
+
};