Things Rust shipped without
graydon2.dreamwidth.org
Things Rust shipped without
1–10 of 330 posts
Re: Things Rust shipped without
#2Re: Things Rust shipped without
#3What does "unions that allow access to the wrong field" mean?
union foo {
int x;
float y;
};
union foo bad;
bad.x = 100;
printf("%f\n", bad.y); // undefined behavior (though usually works)Re: Things Rust shipped without
#4What does "unions that allow access to the wrong field" mean?
This is usually done to "get the byte representation of a float" or things like that.
Except... it's undefined behavior.
Re: Things Rust shipped without
#5What does "unions that allow access to the wrong field" mean?
Re: Things Rust shipped without
#6I haven't done this for a while, but once upon a graduate program I wrote a compiler from a made-up-language (MUP) to C. MUP had some strange control structures, and if C did not have "goto", it would have been a lot more difficult to implement those structures. Since then, I have always thought languages should have a "goto" statement that human-written code is not allowed to use. :)
Re: Things Rust shipped without
#7> goto (not even as a reserved word) I haven't done this for a while, but once upon a graduate program I wrote a compiler from a made-up-language (MUP) to C. MUP had some strange control structures, and if C did not have "goto", it would have been a lot more difficult to implement those structures. Since then, I have always thought languages should have a "goto" statement that human-written code is not allowed to use…
Re: Things Rust shipped without
#8> goto (not even as a reserved word) I haven't done this for a while, but once upon a graduate program I wrote a compiler from a made-up-language (MUP) to C. MUP had some strange control structures, and if C did not have "goto", it would have been a lot more difficult to implement those structures. Since then, I have always thought languages should have a "goto" statement that human-written code is not allowed to use…
(I don't recall whether the borrow checker actually depends on the control flow being reducible, but some of the possible future improvements we've talked about with "non-lexical lifetimes" definitely do. There are also nasty interactions between RAII and irreducible control flow…)
Re: Things Rust shipped without
#9Re: Things Rust shipped without
#10What does "unions that allow access to the wrong field" mean?
In C you can store a value to a field of a union and then read from a different field. This is usually done to "get the byte representation of a float" or things like that. Except... it's undefined behavior.
No longer true since C99.