-
Notifications
You must be signed in to change notification settings - Fork 0
Data Types
Derek Snider edited this page May 19, 2026
·
1 revision
madc supports C integer types, floating point, strings, and typed containers.
| Type | Size | Description |
|---|---|---|
int / int64_t
|
8 bytes | 64-bit signed integer (default integer type) |
int8_t |
1 byte | Signed byte |
int16_t |
2 bytes | Signed 16-bit |
int32_t |
4 bytes | Signed 32-bit |
uint8_t |
1 byte | Unsigned byte |
uint16_t |
2 bytes | Unsigned 16-bit |
uint32_t |
4 bytes | Unsigned 32-bit |
uint64_t |
8 bytes | Unsigned 64-bit |
char |
1 byte | 8-bit character |
float |
4 bytes | Single-precision floating point |
double |
8 bytes | Double-precision floating point |
string s = "hello world";
cout << s << endl;string is backed by C++ std::string. Strings are mutable, grow automatically, and support cout << output. Many namespace functions operate on strings.
array names;
php::array_push(names, "Alice");
php::array_push(names, "Bob");
php::array_push_int(names, 42);array is a mixed-type container (MadValue-based). Elements can be strings or integers. Manipulated via php:: array functions and iterable with range-based for.
vector<int> nums;
nums.push_back(10);
nums.push_back(20);
map<string, int> ages;
ages["Alice"] = 30;
set<string> unique;
unique.insert("hello");Also accessible as std::vector<int>, std::map<string, int>, etc.
| Type | Description |
|---|---|
cout / cerr
|
Standard output / error (also std::cout, std::cerr) |
cin |
Standard input (see Strings & I/O) |
stringstream |
In-memory string stream |
ifstream |
File input stream |
ofstream |
File output stream |
fstream |
File input/output stream |
struct Point {
int x;
int y;
};
class Person {
string name;
int age;
};
Point p; // no 'struct' prefix needed
Person bob;See Structs & Classes for more.
x := 42; // x is int
name := "hello"; // name is string
auto fn = my_func; // fn is a function pointer:= infers the type from the right-hand side. auto infers from function pointer or lambda assignments.
int x = 42;
int *p = &x;
cout << *p << endl; // 42
char *s = "hello";
puts(s);C-style pointers work as expected. See Pointers & Arrays.
- Control Flow — if, for, while, switch, match
- Functions — declarations, multiple returns, lambdas
- Structs & Classes — user-defined types
- ← Back to Home