mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 15:42:49 +00:00
25 lines
408 B
C++
25 lines
408 B
C++
#include "all.h"
|
|
#include <cstdio>
|
|
|
|
void fn_c() {
|
|
SimpleStringOwner c{ "cccccccccc" };
|
|
}
|
|
|
|
void fn_b() {
|
|
SimpleStringOwner b{ "b" };
|
|
fn_c();
|
|
}
|
|
|
|
int main() {
|
|
try {
|
|
SimpleStringOwner a{ "a" };
|
|
fn_b();
|
|
SimpleStringOwner d{ "d" };
|
|
} catch (const Error& e) {
|
|
printf("Error: %s\n", e.what());
|
|
} catch(const std::exception& e) {
|
|
printf("Exception: %s\n", e.what());
|
|
}
|
|
return 0;
|
|
}
|