push和pop编译指示
push/pop 编译指示与option指令非常相似,但用于暂时覆盖设置。 示例:
- {.push checks: off.}
- # 编译本节而不进行运行时检查,因为它对速度至关重要
- # ... some code ...
- {.pop.} # 恢复堆栈
push/pop can switch on/off some standard library pragmas, example:
- {.push inline.}
- proc thisIsInlined(): int = 42
- func willBeInlined(): float = 42.0
- {.pop.}
- proc notInlined(): int = 9
- {.push discardable, boundChecks: off, compileTime, noSideEffect, experimental.}
- template example(): string = "https://nim-lang.org"
- {.pop.}
- {.push deprecated, hint[LineTooLong]: off, used, stackTrace: off.}
- proc sample(): bool = true
- {.pop.}
For third party pragmas it depends on its implementation, but uses the same syntax.