41
you are viewing a single comment's thread
view the rest of the comments
[-] grue@lemmy.world 5 points 10 months ago* (last edited 10 months ago)

What problem do you think that undefined behavior poses?

Each implementation that exhibits different behavior doubles the amount of testing needed to ensure cross-platform correctness.

I'm not saying that specifications should necessarily be so locked-down that every conforming implementation has to behave exactly the same way in every conceivable respect, but I do think that the aspects in which they are allowed to differ should be chosen judiciously (and explicitly allowed by the specification).

[-] bluGill@kbin.social 2 points 10 months ago

Only if you go there. In my experience code doesn't

[-] lysdexic@programming.dev 0 points 10 months ago* (last edited 10 months ago)

Each implementation that exhibits different behavior doubles the amount of testing needed to ensure cross-platform correctness.

Not really. The whole point of undefined behavior is that the standard intentionally leaves out any definition of behavior, or the program is already fundamentally broken.

If you insist on unwittingly using code that relies on undefined behavior, you're the one mindlessly writing broken code. It's not the standard's fault that you're adding bugs.

The irony is that compiler implementations also leverage undefined behavior to save you from yourself and prevent programs to crash when they stumble upon the mess you've done with the code.

this post was submitted on 24 Dec 2023
41 points (86.0% liked)

Rust

5890 readers
31 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS