mastodon.sdf.org is part of the decentralized social network powered by Mastodon.
"I appreciate SDF but it's a general-purpose server and the name doesn't make it obvious that it's about art." - Eugen Rochko

Administered by:

Server stats:

2.6K
active users

Learn more

argv minus one

It's been a while since I ran a build with / . I had forgotten just how many different little things it checks for.

One of the main things it's checking for is whether certain headers and functions exist. That reminds me: `cfg` directives really ought to allow a predicate of “such-and-such function/type/whatever exists”. Then you can, for example, call a libc function that exists only on platforms that have it, with fallback on platforms that don't.

The usual solution to this problem seems to be to not even attempt to use a function or other item unless the target platform is one that the programmer knows has support for it.

This has two serious problems:

1. The list of supporting platforms tends to be huge. Example: docs.rs/socket2/0.5.8/src/sock
2. What if more platforms gain support for it in the future?

socket.rs - sourcedocs.rs

This was discussed before users.rust-lang.org/t/how-to-c where it was said that the required information doesn't exist yet. But surely the information does exist if the item path in question points into another crate that is already compiled?

How to conditionally compile if function/type exists?The Rust Programming Language Forum

@argv_minus_one You know... `autoconf` was for times, when we have several #Unix systems in the field, each significantly different from each other, especially in terms of `libc` support. Today we have 3, with one having two flavours - `musl` and `glibc`; third one from #Apple is not usually that strongly supported.

Then keep in mind `autoconf` was practically non-existent on #Windows (and no, #Cygwin and #msys don't count).