I went over tutorial and spotted a few typos (see below).
I think the SHA-1 example shouldn't use the static buffer because it
is not task-safe.
More significantly, the gettimeofday example still uses the wrong
types for time_t and suseconds_t. time_t is usually signed and not
always 64 bit (or the size of a machine word). suseconds_t can be a
32-bit type even on 64-bit machines, and the padding is in the wrong
place on big-endian machines. Not sure if rustc already works on
anything besides i386 and amd64 on GNU libc platforms. But even to
support these two, you need this:
type timeval = {mut tv_sec: c_long, mut tv_usec: c_long};
time_t and suseconds_t are two of the most problematic types for FFI.
It's difficult to find structs in POSIX which are essentially fixed.
struct pollfd appears to be one such type, but the example would have
to be larger.
diff --git a/doc/tutorial.md b/doc/tutorial.md
index ed32100..78f41e3 100644
--- a/doc/tutorial.md
+++ b/doc/tutorial.md
@@ -350,7 +350,7 @@ more underscores.
The double-colon (`::`) is used as a module separator, so
`io::println` means 'the thing named `println` in the module
-named `io`'.
+named `io`.
Rust will normally emit warnings about unused variables. These can be
suppressed by using a variable name that starts with an underscore.
@@ -1413,7 +1413,7 @@ let exchange_crayons: ~[crayon] = ~[banana_mania, beaver,
bittersweet];
> but is deprecated. In the future it will probably represent some
> "reasonable default" vector type.
>
-> Unique vectors are the currently-recomended vector type for general
+> Unique vectors are the currently-recommended vector type for general
> use as they are the most tested and well-supported by existing
> libraries. There will be a gradual shift toward using more
> stack and local vectors in the coming releases.
@@ -2814,7 +2814,7 @@ C functions often take pointers to structs as arguments.
Since Rust
records are binary-compatible with C structs, Rust programs can call
such functions directly.
-This program uses the Posix function `gettimeofday` to get a
+This program uses the POSIX function `gettimeofday` to get a
microsecond-resolution timer.
~~~~
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev