error pragma
The error pragma is used to make the compiler output an error message with the given content. The compilation does not necessarily abort after an error though.
The error pragma can also be used to annotate a symbol (like an iterator or proc). The usage of the symbol then triggers a static error. This is especially useful to rule out that some operation is valid due to overloading and type conversions:
## check that underlying int values are compared and not the pointers:
proc `==`(x, y: ptr int): bool {.error.}
当前内容版权归 nim-lang.org 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 nim-lang.org .