mirror of
https://github.com/nim-lang/Nim.git
synced 2026-08-31 02:43:41 +00:00
new destroyer pass works with procs too
This commit is contained in:
@@ -78,11 +78,11 @@ proc create*(lit: string): mystring =
|
||||
copyMem(addr result.data[result.len], unsafeAddr lit[0], newLen + 1)
|
||||
result.len = newLen
|
||||
|
||||
func `&`*(a, b: mystring): mystring =
|
||||
proc `&`*(a, b: mystring): mystring =
|
||||
result = a
|
||||
result.add b
|
||||
|
||||
func main(n: int) =
|
||||
proc main(n: int) =
|
||||
var a: mystring
|
||||
let b = create" to append"
|
||||
for i in 0..<n:
|
||||
@@ -92,6 +92,5 @@ func main(n: int) =
|
||||
a.add c
|
||||
echo cstring(a.data)
|
||||
|
||||
|
||||
main(1000)
|
||||
echo "after ", allocCount, " ", deallocCount
|
||||
|
||||
Reference in New Issue
Block a user