4 ms·
Yes 683 pages, but 178 of that is the language: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1548.pdf http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1548
by CalChris 9y ago
Yes 683 pages, but 178 of that is the language:
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1548.pdf http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1548.pdf
That's up from 95 in C90, a factor of 2 not 3 in 20 years.
http://read.pudn.com/downloads133/doc/565041/ANSI_ISO%2B9899-1990%2B[1].pdf http://read.pudn.com/downloads133/doc/565041/ANSI_ISO%2B9899...
You can treat Rust as a useful language as long as you don't need to get work done. I rather like C11. I would have liked Rust, I tried, if they'd have known when to say no or if they valued sparseness for its readability because it reads like C+++:
const USAGE: &'static str = "usage: blah blah";
By contrast, I like what seL4 did with C. They wrote in C and proved in Isabelle.
- steveklabnik 9y agoIn today's Rust you can drop the 'static.
- deathanatos 9y agoThis example is one of those things I keep running into though, and don't fully understand: why does type inference not work on consts? e.g., here, why can't we drop the entire type: const USAGE = "usage: blah blah"; The RHS has sufficient type information, does it not? After all, if this were a let USAGE = ... inside a function, that would be sufficient. (I don't find this particular bit a deal-breaker though; thus far, I quite like Rust.)
- steveklabnik 9y agoThis was an explicit decision; we could do this kind of inference but chose not to, similar to how you must declare the types of functions. We started with the most conservative choice, and then are feeling it out; that's why you can now drop the lifetime.
- kibwen 9y agoNot sure why this is being downvoted. The GP commenter is mistaken, the following line is completely valid Rust: const USAGE: &str = "usage: blah blah"; Compare it to the equivalent in C: const char *USAGE = "usage: blah blah";
- CalChris 9y agoAnd while you are at it, compare that to: #define USAGE "usage: blah blah"
- dtolnay 9y agoThe equivalent C needs a second const -- your first one refers to the data behind the string but not the string pointer, and is more like Rust's `let usage: &str`. const char * const USAGE = "usage: blah blah";
- crzwdjk 9y agoOr rather `let mut usage: &str`. Rust actually is kind of similar to C here in that the pointer and pointee can be separately const or mutable. But in Rust "const" is the default and mut needing to be explicitly declared, whereas with C it's the other way around.
- kazinator 9y agoIn C90, the Language clause goes from page 18 to 95, so 78 pages. Not 3X less but 2.3X.