short C names deprecated (itoa, ftoa), C reimplementations of atoi and atof deprecated as parse_int() and parse_f64() are preferable

This commit is contained in:
samwega
2025-10-03 20:54:18 +03:00
parent 54805c600e
commit 01bbd981ad
2 changed files with 30 additions and 54 deletions
+24
View File
@@ -36,3 +36,27 @@ append_u128 :: proc(buf: []byte, u: u128, base: int) -> string {
append_float :: proc(buf: []byte, f: f64, fmt: byte, prec, bit_size: int) -> string {
return write_float(buf, f, fmt, prec, bit_size)
}
// 2025-10-03 Deprecated C short names and implementations
@(deprecated="Use int_to_string instead")
itoa :: proc(buf: []byte, i: int) -> string {
return write_int(buf, i64(i), 10)
}
@(deprecated="Use strconv.parse_int() instead")
atoi :: proc(s: string) -> int {
v, _ := parse_int(s)
return v
}
@(deprecated="Use parse_f64() instead")
atof :: proc(s: string) -> f64 {
v, _ := parse_f64(s)
return v
}
@(deprecated="Use write_float instead")
ftoa :: proc(buf: []byte, f: f64, fmt: byte, prec, bit_size: int) -> string {
return string(generic_ftoa(buf, f, fmt, prec, bit_size))
}