HaxeFoundation / HaxeFoundation/haxe
Ambiguous specification of haxe.io.Output.writeByte()
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
```
class Main {
public static function main():Void {
Sys.stdout().writeByte(-159);
}
}
```
Above code behaves inconsistent across targets.
neko throws error, cpp and java exits with no output, php outputs an `a`, ...
Actually, `haxe.io.Output.writeByte()` won't accept anything outside 0...256 range but is not documented.
At least we need an "If `x` is outside of the unsigned byte range, the result is unspecified" clause.
Or, as a more robust fix, maybe we need a `writeUInt8(x:Int):Void` which throws `haxe.io.Error.Overflow` if outside range, to complement other methods.
Submitted this as an Issue because I'm not sure which PR should I make.
Contributor guide
Assessment
This issue has not been assessed yet.