Re: BSD Fragmentation

Richard Kettlewell <[email protected]>
Newsgroups comp.misc
Organization terraraq NNTP server
Message-ID <[email protected]>
Lawrence D’Oliveiro <[email protected]> writes:
> Even developing software to port between BSD variants is not
> completely straightforward. Look at this
> <https://code.videolan.org/videolan/libdvdread/-/compare/e149111f8f69ef291e4d8c166527257c3c86cea4...337c1519ed6ecdd123b07c56d0aceda169b6ae61>:
>
>     #if defined(__linux__) || defined(__GLIBC__)
>         ...
>     #elif defined(__APPLE__)
>         ...
>     #elif defined(__NetBSD__)
>         ...
>     #elif defined(__OpenBSD__)
>         ...
>     #elif defined(__FreeBSD__) && __FreeBSD_version >= 470000
>         ...
>     #elif defined(__DragonFly__)
>         ...
>     #elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__) || defined(_WIN32) || defined(__CYGWIN__) || defined(__BEOS__) || defined(__OS2__)
>         ...
>
> All the Linux distros work the same. But every single flavour of BSD
> seems to do things differently.

Are you incapable of reading diffs, or is your case so weak you have to
rely on misleading examples? The link actually shows the removal of most
of the per-platform variation, creating the situation shown at:

https://code.videolan.org/videolan/libdvdread/-/blob/master/src/bswap.h?ref_type=heads

...where there is zero variation between the BSDs.

(It could actually be simplified further: competent compilers generate
bswap or rotate instructions for the L49-51 macros, meaning there is no
real need to bother with the compiler intrinsics.  See
https://godbolt.org/z/89h6zvr4Y.)

-- 
https://www.greenend.org.uk/rjk/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.