The main posixpp library and associated tests.
Rev. | Time | Author | Message |
---|---|---|---|
5f78080a2b88 | 2022-12-08 23:28:42 | Eric Hopper | tip Add some comments inspired by a ChatGPT session. |
901261d5fd16 | 2022-01-12 01:03:33 | Eric Hopper | Add sample compile command so I don't have to reconstruct... |
b1b7172b6000 | 2022-01-11 04:41:07 | Eric Hopper | Merge with other clang-tidy cleanups. |
adc44f7e5a6f | 2022-01-11 04:22:51 | Eric Hopper | Add support for fcntl + wrapper for F_DUPFD and F_DUPFD_C... |
857a394ad592 | 2022-01-11 04:19:25 | Eric Hopper | Fix various random clang-tidy complaints. |
15ec4b4900e4 | 2022-01-11 03:43:12 | Eric Hopper | Remove excess blank line. |
65d4804a6639 | 2022-01-11 03:41:44 | Eric Hopper | Silence "return from norreturn" warnings. |
0985bb9e2c34 | 2022-01-11 03:40:46 | Eric Hopper | Fix destructor for union to be constexpr so expected<T> d... |
a69f8a0de90c | 2021-06-30 02:38:38 | Eric Hopper | Fix various clang-tidy complaints. |
9eb80934ba7d | 2021-05-11 01:07:00 | Eric Hopper | Fix 'move to self' bug. |
Name | Rev. | Time | Author |
---|---|---|---|
tip | 5f78080a2b88 | 2022-12-08 23:28:42 | Eric Hopper |
Name | Rev. | Time | Author | Message |
---|---|---|---|---|
default | 5f78080a2b88 | 2022-12-08 23:28:42 | Eric Hopper | Add some comments inspired ... |
With this project, I intend to implement many parts of Posix in pure C++ without any reliance on libc. There are several motivations for this:
errno
is a horrible hack that is a throwback to a single threaded
era and a language that could not sensibly return both error
conditions and proper return values from the same function. errno
is the bane of clean error handling, and it requires expensive to
access thread local storage to implement. Error returns should not
be global variables.For motivation 2 I intend to implement the system call interface for many architectures (and potentially many operating systems) as inline assembly inside of inline functions.
For motivation 3, a simple expected
type is used for error handling at
every level of the interface. This also causes default error handling
(if you just assume the expected
object always contains the expected
value) to throw an exception whenever errors are ignored. And if you
purposely check for errors, all code relating to exceptions will be
optimized out of existence.
Ideally, parts of the C++ standard library that rely on operating system facilities would also be implemented in this library.
For example, pthreads is a terrible interface, designed when threading was mysterious, strange, complex, and rare. And it was designed for old ideas about how threads should synchronize. It's far more expensive to use than it should be for simple mutexes and condition variables.
IOstreams isn't the best part of C++. But, being able to implement it while ignoring C's stdio might make things easier.
Lastly, it would be really nice to have a preprocessor namespace that isn't chock full macro definitions (most of which are just using the preprocessor to implement constants in a throwback to the days before C90). And it would be nice to have names and types for various flags passed to various system calls that made it easier to write correct programs.
As a side note, I really like Mercurial, and so the canonical repo is at OSDN: https://osdn.net/projects/posixpp/scm/hg/posixpp