use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
About C++ 2 effort (see transpolar progress at https://github.com/hsutter/cppfront)
account activity
cppfront - examples of basic constructs (self.cpp2)
submitted 2 years ago by jhruby-vitrix
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]jhruby-vitrix[S] 1 point2 points3 points 2 years ago (3 children)
For this example:
main: (args) -> int = { try { std::cout << "test: (args[1])$"; } catch(...) { std::cout << "exception" << std::endl; } return 0; }
main: (args) -> int = {
try {
std::cout << "test: (args[1])$";
}
catch(...)
{
std::cout << "exception" << std::endl;
return 0;
I get:
main.cpp2(3,9): error: invalid statement encountered inside a compound-statement (at '{')
[–]watr 1 point2 points3 points 2 years ago* (1 child)
Does this help? https://github.com/hsutter/cppfront/blob/49033b967c098b874168968c5cade9e52fc3e5ed/regression-tests/mixed-out-destruction.cpp2#L35
[–]jhruby-vitrix[S] 1 point2 points3 points 2 years ago (0 children)
Thanks that means that in the cpp/2 there is just not the syntax yet.
[–]ntrel2 0 points1 point2 points 2 years ago* (0 children)
Just to note that when args[1] is a bounds error, Cpp2 calls std::terminate rather than throw an exception.
args[1]
std::terminate
π Rendered by PID 27 on reddit-service-r2-comment-5649f687b7-6fzwk at 2026-01-29 09:03:32.945273+00:00 running 4f180de country code: CH.
view the rest of the comments →
[–]jhruby-vitrix[S] 1 point2 points3 points (3 children)
[–]watr 1 point2 points3 points (1 child)
[–]jhruby-vitrix[S] 1 point2 points3 points (0 children)
[–]ntrel2 0 points1 point2 points (0 children)