Thanks! I will do that!
You should be able to use `SomeInteger` instead, which is declared as:
type
SomeSignedInt* = int|int8|int16|int32|int64
SomeUnsignedInt* = uint|uint8|uint16|uint32|uint64
SomeInteger* = SomeSignedInt|SomeUnsignedInt
Convert the argument to `int` via `int(off)`,
Hmmm. Is there a better way for these templates to handle both signed and
unsigned values? Maybe an extra template parameter?
If you're using `Natural`, note that this type describes only a subset of
`int`. If the highest bit is set, this can result in a runtime error.
Very useful templates for anyone interfacing with C. Thank you very much.
Since I usually do a lot of pointer work in a given file, I switched to this:
template usePtr*[T]() =
template `+`(p: ptr T, off: Natural): ptr T =
cast[ptr type(p[])](cast[ByteAddress](p) +% int
**cdunn2001:** _This no longer compiles._
Nothing changed, it was actually always a bug. Yes, the inner export markers
need to go, but they should never have been there in the first place. It works
in the test only because there the code is not inside a procedure.
**cdunn2001:** _Also, is there
This no longer compiles.
foo.nim(155, 7) template/generic instantiation from here
foo.nim(66, 15) Error: 'export' is only allowed at top level
template `+`*[T](p: ptr T, off: int): ptr T =
^
I think the start (*) needs to be removed. Also, is ther