parent
3d2459bdc0
commit
89be5be03e
2 changed files with 7 additions and 2 deletions
|
|
@ -45,9 +45,9 @@ proc nimCmpMem*(a, b: pointer, size: Natural): cint {.compilerproc, nonReloadabl
|
||||||
if d != 0: return d
|
if d != 0: return d
|
||||||
inc i
|
inc i
|
||||||
|
|
||||||
proc nimCStrLen*(a: cstring): csize_t {.compilerproc, nonReloadable, inline.} =
|
proc nimCStrLen*(a: cstring): int {.compilerproc, nonReloadable, inline.} =
|
||||||
when useLibC:
|
when useLibC:
|
||||||
c_strlen(a)
|
cast[int](c_strlen(a))
|
||||||
else:
|
else:
|
||||||
var a = cast[ptr byte](a)
|
var a = cast[ptr byte](a)
|
||||||
while a[] != 0:
|
while a[] != 0:
|
||||||
|
|
|
||||||
|
|
@ -41,3 +41,8 @@ except OverflowDefect, RangeDefect:
|
||||||
echo x
|
echo x
|
||||||
|
|
||||||
echo expected == 4
|
echo expected == 4
|
||||||
|
|
||||||
|
# bug #13698
|
||||||
|
var
|
||||||
|
x45 = "hello".cstring
|
||||||
|
p = x45.len.int32
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue