introduce --laxStrings:on switch
This commit is contained in:
parent
1a3b35603c
commit
851d2a266d
2 changed files with 4 additions and 2 deletions
|
|
@ -85,7 +85,9 @@
|
||||||
these is ``"" / @[]``.
|
these is ``"" / @[]``.
|
||||||
- Accessing the binary zero terminator in Nim's native strings
|
- Accessing the binary zero terminator in Nim's native strings
|
||||||
is now invalid. Internally a Nim string still has the trailing zero for
|
is now invalid. Internally a Nim string still has the trailing zero for
|
||||||
zero-copy interoperability with ``cstring``.
|
zero-copy interoperability with ``cstring``. Compile your code with the
|
||||||
|
next switch ``--laxStrings:on`` if you need a transition period.
|
||||||
|
|
||||||
|
|
||||||
### Tool changes
|
### Tool changes
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -909,7 +909,7 @@ proc genSeqElem(p: BProc, n, x, y: PNode, d: var TLoc) =
|
||||||
if ty.kind in {tyRef, tyPtr}:
|
if ty.kind in {tyRef, tyPtr}:
|
||||||
ty = skipTypes(ty.lastSon, abstractVarRange) # emit range check:
|
ty = skipTypes(ty.lastSon, abstractVarRange) # emit range check:
|
||||||
if optBoundsCheck in p.options:
|
if optBoundsCheck in p.options:
|
||||||
if ty.kind == tyString and not defined(nimNoZeroTerminator):
|
if ty.kind == tyString and (not defined(nimNoZeroTerminator) or optLaxStrings in p.options):
|
||||||
linefmt(p, cpsStmts,
|
linefmt(p, cpsStmts,
|
||||||
"if (!$2 || (NU)($1) > (NU)($2->$3)) #raiseIndexError();$n",
|
"if (!$2 || (NU)($1) > (NU)($2->$3)) #raiseIndexError();$n",
|
||||||
rdLoc(b), rdLoc(a), lenField(p))
|
rdLoc(b), rdLoc(a), lenField(p))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue