Liste des Groupes | Revenir à c arch |
Terje Mathisen wrote:
>Tim Rentsch wrote:>
>I'm always somewhat surprised when someone advocates using a cast>
for such things, and now more surprised to learn that Rust has
chosen to impose using a cast as part of its language rules. I
I am not _sure_ but I believe Rust will in fact verify that all such
casts are in fact legal, i.e. the data will fit in the target
container.
>
This is of course the total opposite of the C "nuclear option", and
much more like other languages that try to be secure by default.
Just to make sure I spoke to our resident Rust guru, and he told me I
was wrong:
>
Rust does have conversion operators/functions for downsizing
variables, and they come with full validity checking, but using "s as
u8" as I suggested will generate exactly the same code as a C
"(uint8_t) s" idiom, i.e. no verification and no safety checks.
Date | Sujet | # | Auteur | |
11 Mar 24 | Re: Cray style vectors | 1 | Tim Rentsch |
Les messages affichés proviennent d'usenet.