News for hackers. Stuff that matters.
Re:Why isn't memset() async-signal-safe? by lmm on Wednesday January 04, 2017 @05:00AM (#13316967)
POSIX doesn't guarantee that memset is async-signal-safe, that is clear enough, and flags like this are even a reasonable rationale. But it sounds like post-2008 memset is and should be async-signal-safe on Linux. Are there relevant systems on which it isn't? IME it's impractical to write code that will work on all POSIX-compliant systems as the standard leaves too much undefined and there is no testsuite that will let you determine when your code is depending on something beyond the minimum requirements of POSIX.
Re:Why isn't memset() async-signal-safe? by pjmlp on Wednesday January 04, 2017 @05:40AM (#13317101)
Welcome to POSIX.

As for GNU/Linux, can you assure memset works that way in all hardware platforms supported by Linux?

Even it does, no one intending to write portable UNIX code can rely on it anyway.

Re:Why isn't memset() async-signal-safe? by lmm on Wednesday January 04, 2017 @07:18AM (#13317627)
> As for GNU/Linux, can you assure memset works that way in all hardware platforms supported by Linux?

I don't know, that's why I'm asking.

I'm not going to try to write code portable to all theoretically possible unices - I doubt anyone has managed that for nontrivial programs, and it's too hard to tell. Hell, I'm content to exclude a fair few systems I know exist (CHAR_BIT != 8, non-IEEE FP). If it's supported on all the platforms I've heard of I'll do it - it's just not practical to hope to be POSIX-complient in a language-lawyer sense.

Re:Why isn't memset() async-signal-safe? by pjmlp on Wednesday January 04, 2017 @07:39AM (#13317742)
> I doubt anyone has managed that for nontrivial programs, and it's too hard to tell.

In the early 2000's, the company I worked for was deploying UNIX based software for GNU/Linux, FreeBSD, HP-UX, Aix, Solaris and Windows (yes Windows, not a typo).

Re:Why isn't memset() async-signal-safe? by lmm on Wednesday January 04, 2017 @10:07AM (#13318801)
Sure, writing a program that works on 6 actually existing unices with test instances (or even just documentation) is relatively easy. Writing one for all possible unices including some that don't exist at the time of writing is a lot harder.
Re:Why isn't memset() async-signal-safe? by pjmlp on Wednesday January 04, 2017 @02:51PM (#13321452)
Those 6 were already enough to learn how "portable" POSIX actually is.