POSIX实现的状态 [英] Status of POSIX implementations

查看:155
本文介绍了POSIX实现的状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚发现的函数getline()函数,它原本是一个GNU扩展,现在是2008年POSIX标准的一部分。

I just found out that the getline() function which is originally a GNU extension is now part of the POSIX 2008 standard.

有没有是怎么广泛支持这个版本的POSIX的一些概述?

Is there some overview of how broadly is this version of POSIX supported?

推荐答案

我只想继续使用它。这是可能实现函数getline (而不是更强大的 getdelim )围绕一个非常快速/高效的包装与fgets ,所以如果你愿意这样做,作为备用,使用函数getline 并没有真正让你的程序的任何便携少。 (而不是像使用 __ fpending ,它无法实现可移植性和需要实现特定的黑客模仿。)

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.)

另外,当然,无论是函数getline getdelim 可以简单地在上面实施 flockfile / funlockfile 龟etc 。这是不是很有效,但它会在任何地方工作。

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.

这篇关于POSIX实现的状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆