Skip to content

Commit

Permalink
strconv: remove deprecations for strconv.v_sprintf and strconv.v_prin…
Browse files Browse the repository at this point in the history
…tf (part 1)
  • Loading branch information
spytheman committed Jul 10, 2023
1 parent e7af25e commit 6b00685
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions vlib/strconv/vprintf.c.v
Expand Up @@ -23,20 +23,24 @@ enum Char_parse_state {
}

// v_printf prints a sprintf-like formated `string` to the terminal.
[deprecated: 'use string interpolation instead']
// The format string `str` can be constructed at runtime.
// Note, that this function is unsafe.
// In most cases, you are better off using V's string interpolation,
// when your format string is known at compile time.
fn v_printf(str string, pt ...voidptr) {
print(v_sprintf(str, ...pt))
}

// v_sprintf returns a sprintf-like formated `string`.
//
// The format string `str` can be constructed at runtime.
// Note, that this function is unsafe.
// In most cases, you are better off using V's string interpolation,
// when your format string is known at compile time.
// Example:
// ```v
// x := 3.141516
// assert strconv.v_sprintf('aaa %G', x) == 'aaa 3.141516'
// ```
[deprecated: 'use string interpolation instead']
[deprecated_after: '2023-06-30']
[direct_array_access; manualfree]
pub fn v_sprintf(str string, pt ...voidptr) string {
mut res := strings.new_builder(pt.len * 16)
Expand Down

0 comments on commit 6b00685

Please sign in to comment.