I just found out that the getline()
function which is originally a GNU extension is now part of the POSIX 2008 standard.
Is there some overview of how broadly is this version of POSIX supported?
Is POSIX still relevant? Yes: Standard interfaces mean easier porting of applications. The POSIX interfaces are widely implemented and referenced in other standardization efforts, including the Single UNIX Specification and the Linux Standard Base.
The POSIX real-time extensions define real-time services such as real-time signals, real-time scheduling policies, task synchronization mechanisms, clocks, and timers. A real-time OS that is POSIX compliant typically implements both the core OS services and the real-time extensions, with the capability ...
The newest version is fully POSIX compliant and is (iirc) mapped more directly onto the Windows kernel than before, causing an increase in speed.
I would just go ahead and use it. It's possible to implement getline
(but not the more powerful getdelim
) as a very fast/efficient wrapper around fgets
, so if you're willing to do that as a fallback, using getline
doesn't really make your program any less portable. (Versus something like using __fpending
, which cannot be implemented portably and requires an implementation-specific hack to emulate.)
Also, of course, both getline
and getdelim
can simply be implemented on top of flockfile
/funlockfile
and fgetc
. It's not very efficient, but it will work anywhere.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With