Post B7da4NLgBeOk8qEGA4 by rose@snac.pinkro.se
(DIR) More posts by rose@snac.pinkro.se
(DIR) Post #B7da4NLgBeOk8qEGA4 by rose@snac.pinkro.se
1 likes, 0 repeats
Working on gardenhouse has taught me one major thing:No one ever knows what actually is posix and what isn'tIt's like schrödingers cat. We won't know if something is posix or not until we check the docs
(DIR) Post #B7df9mzWm6VmtEGhge by SRAZKVT@tech.lgbt
0 likes, 0 repeats
@rose and we hope stuff is in posix even if it isn't (reallocarray)
(DIR) Post #B7df9nFTonGvghjRYG by navi@social.vlhl.dev
0 likes, 0 repeats
@SRAZKVT @rose https://pubs.opengroup.org/onlinepubs/9799919799/functions/realloc.htmlthat one is in posix 2024 :3
(DIR) Post #B7df9nTey4cAOgMlea by SRAZKVT@tech.lgbt
0 likes, 0 repeats
@navi @rose imo posix 2024 is too new to be relied upon fully, like c23but cool to know
(DIR) Post #B7df9njG255jB3fDxw by navi@social.vlhl.dev
0 likes, 0 repeats
@SRAZKVT @rose with the exception of new interfaces (which can be told apart by looking the posix_ prefix, like posix_devctl), i disagreemost "new" posix interfaces are already widespread extensions getting standardized -- if it got into posix it's already available in enough systems that imo it's fine to use
(DIR) Post #B7df9nwNFJaDpjnhPU by SRAZKVT@tech.lgbt
0 likes, 0 repeats
@navi @rose widespread sure, but not everywhere, i would still rather wait a few years for other operating systems to implement those, though it depends on how hard to implement those would actually be. if you already have calloc and realloc, reallocarray shouldn't be too complicated
(DIR) Post #B7df9o98Trn8TJltIm by mirabilos@toot.mirbsd.org
0 likes, 0 repeats
@SRAZKVT @navi @rose I’d even say newer POSIX features are getting into systems faster than newer C standards
(DIR) Post #B7dfExhCP5aDXLA6BU by navi@social.vlhl.dev
0 likes, 0 repeats
@SRAZKVT @rose by that logic no posix function is trully good enough regardless of version (even things from posix 2007 or older is sometimes missing or fucked up on odd platforms, just ask @ska how making sure stuff builds on every unix-y out ther goes)me personally, it's best effort, if it's in posix i consider it widespread enough, if it's not, or it's too new, i check about half a dozen unixes to see if they have it and if so, i'll use it
(DIR) Post #B7dfEyN1tZ2ld4jVNw by ska@social.treehouse.systems
1 likes, 0 repeats
@navi @rose @SRAZKVT Yeah, it's all very empiric and trial-and-error. Basically, you need to try being portable on paper when writing the code, and then you need to decide what OSes you're going to explicitly support so the build works out of the box; you try it, and adjust the code with FTM-fu until it builds on all your targets. There is little science to it, and no honor at all.Most of the problems come from the fact than even when you nominally stick to POSIX, few OSes actually follow the rules, and the practice of porting is pretty different from the theory. Oftentimes, in order to get POSIX functions properly defined and implemented, you need to not define _POSIX_SOURCE or equivalent. The fewer FTMs, the closer to the "native" definitions, and the more chances the compiler has to find the declaration you want.My own test-build infrastructure relies heavily on the cfarm project https://portal.cfarm.net/ which is awesome for this. They even provide access to AIX, an OS I gave up on supporting. If you're interested in portability, I heartily recommend opening accounts there. 😀
(DIR) Post #B7dfEyekpfDoW31f0q by mirabilos@toot.mirbsd.org
0 likes, 0 repeats
@ska @navi @rose @SRAZKVT no xlC on cfarm for AIX any more, though(not the xlC that counts, anyway; later versions are just bad wrappers for old LLVM+Clang)
(DIR) Post #B7dfwFQKMqsCyFuWWG by ska@social.treehouse.systems
0 likes, 0 repeats
@mirabilos @navi @rose @SRAZKVT xlC? Is that the OG C compiler for AIX?
(DIR) Post #B7dfwFgzMuCVnvhpUO by mirabilos@toot.mirbsd.org
0 likes, 0 repeats
@ska @navi @rose @SRAZKVT …yes?
(DIR) Post #B7dgBMTwPJVrCno8jw by ska@social.treehouse.systems
0 likes, 0 repeats
@mirabilos @navi @rose @SRAZKVT Well I didn't know. And is it a loss that it's not there? Was there value in it?
(DIR) Post #B7dgBMqd2xf2LAQG6S by mirabilos@toot.mirbsd.org
0 likes, 0 repeats
@ska @navi @rose @SRAZKVT yes, with every vendor or otherwise alternative compiler I tested, I found things to improve
(DIR) Post #B7dgERo54A6yaZhQ9I by mirabilos@toot.mirbsd.org
0 likes, 0 repeats
@ska @navi @rose @SRAZKVT did you only ever test with GCC everywhere or how? 🙀
(DIR) Post #B7dgeRNZHKj4n9h0cq by ska@social.treehouse.systems
0 likes, 0 repeats
@mirabilos @navi @rose @SRAZKVT No, I use cc wherever it's available. Sometimes it's gcc, sometimes it's clang; more rarely it's something else. If there are other compilers provided on a platform, I will use them, but I'm not gonna go out of my way to install extra compilers.
(DIR) Post #B7dgeRiU1ZSLq1TiE4 by mirabilos@toot.mirbsd.org
0 likes, 0 repeats
@ska @navi @rose @SRAZKVT ah that would be xlC normally