liblinux++

A hosted C++ runtime without any libc.
git clone git://henryandlizzy.uk/liblinux++
Log | Files | Refs

hello.cpp (370B)


      1 #include "linux.hpp"
      2 
      3 int main()
      4 {
      5 	auto msg = "Hello, World!\n"_sp;
      6 	auto res = write(stdout, msg);
      7 
      8 	if (not res)
      9 	{
     10 		span<char const> const iov[] = {
     11 			"write() failed: "_sp,
     12 			errname(res.err()),
     13 			"\n"_sp
     14 		};
     15 		(void)write(stderr, span{iov});
     16 		return 1;
     17 	}
     18 
     19 	if (*res != msg.size())
     20 	{
     21 		(void)write(stderr, "Wrote less than expected\n"_sp);
     22 		return 1;
     23 	}
     24 }