fuel-specs icon indicating copy to clipboard operation
fuel-specs copied to clipboard

Unclear behaviour around flags `F_WRAPPING` & `F_UNSAFEMATH`

Open nfurfaro opened this issue 2 years ago • 4 comments

If the F_UNSAFEMATH flag is unset, an operation that would have set $err to true is instead a panic. If the F_WRAPPING flag is unset, an operation that would have set $of to a non-zero value is instead a panic.

It might be just me, but these make it sound like the user needs to take an action (ie: "unset" the flags) in order to have the panic behaviour. As panic is the default behaviour (and the flags are "unset" to start with), I propose the wording change to something like:

  • If the F_UNSAFEMATH flag is set, an operation that would have panicked will instead set $err to a non-zero value.
  • If the F_WRAPPING flag is set, an operation that would have panicked will instead set $of to a non-zero value.

cc @adlerjohn

nfurfaro avatar May 19 '22 12:05 nfurfaro

"Unset" here is more of a hardware term that means "zero." Since registers are all initialized to zero, by default the flag bits are all unset.

adlerjohn avatar May 19 '22 12:05 adlerjohn

Yes, I get that "unset" here describes a state rather than a verb, but I still think the wording would be improved as suggested. I find it harder to parse than it needs to be.

nfurfaro avatar May 19 '22 12:05 nfurfaro

Yes, agree the wording can be clearer.

adlerjohn avatar May 19 '22 12:05 adlerjohn

https://github.com/FuelLabs/fuel-specs/pull/408#pullrequestreview-1122126294

adlerjohn avatar Sep 27 '22 14:09 adlerjohn

@adlerjohn can this be closed?

Voxelot avatar Dec 06 '22 20:12 Voxelot

This one still needs to be fixed as per the above comment.

adlerjohn avatar Dec 07 '22 04:12 adlerjohn