blob: e5177436d8d3845d2d4d63648b960001a4150ffd (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
discard """
output: '''
Length correct
Correct
Correct
Correct
Correct
Correct
Correct
Correct
Correct
'''
"""
type
TIdObj* = object of RootObj
id*: int # unique id; use this for comparisons and not the pointers
PIdObj* = ref TIdObj
PIdent* = ref TIdent
TIdent*{.acyclic.} = object
s*: string
proc myNewString(L: int): string {.inline.} =
result = newString(L)
if result.len == L: echo("Length correct")
else: echo("bug")
for i in 0..L-1:
if result[i] == '\0':
echo("Correct")
else:
echo("Wrong")
var s = myNewString(8)
|