diff --git a/compiler/fn.v b/compiler/fn.v index 19ef378ab3..1d70c7ca9a 100644 --- a/compiler/fn.v +++ b/compiler/fn.v @@ -808,11 +808,13 @@ fn (p mut Parser) fn_call_args(f mut Fn) *Fn { // (If we don't check for void, then V will compile `println(func())`) if i == 0 && f.name == 'println' && typ != 'string' && typ != 'void' { T := p.table.find_type(typ) - fmt := p.typ_to_fmt(typ, 0) - if fmt != '' { - p.cgen.resetln(p.cgen.cur_line.replace('println (', '/*opt*/printf ("' + fmt + '\\n", ')) - continue - } + $if !windows { + fmt := p.typ_to_fmt(typ, 0) + if fmt != '' { + p.cgen.resetln(p.cgen.cur_line.replace('println (', '/*opt*/printf ("' + fmt + '\\n", ')) + continue + } + } if typ.ends_with('*') { p.cgen.set_placeholder(ph, 'ptr_str(') p.gen(')') diff --git a/compiler/parser.v b/compiler/parser.v index 3eb43faa76..751837cc60 100644 --- a/compiler/parser.v +++ b/compiler/parser.v @@ -2395,12 +2395,14 @@ fn (p mut Parser) string_expr() { return } // println: don't allocate a new string, just print it. - cur_line := p.cgen.cur_line.trim_space() - if cur_line.contains('println (') && p.tok != .plus && - !cur_line.contains('string_add') && !cur_line.contains('eprintln') { - p.cgen.resetln(cur_line.replace('println (', 'printf(')) - p.gen('$format\\n$args') - return + $if !windows { + cur_line := p.cgen.cur_line.trim_space() + if cur_line.contains('println (') && p.tok != .plus && + !cur_line.contains('string_add') && !cur_line.contains('eprintln') { + p.cgen.resetln(cur_line.replace('println (', 'printf(')) + p.gen('$format\\n$args') + return + } } // '$age'! means the user wants this to be a tmp string (uses global buffer, no allocation, // won't be used again)