Skip to content

Commit

Permalink
Added doc comments for std::debug
Browse files Browse the repository at this point in the history
  • Loading branch information
mauro-balades committed Jan 28, 2024
1 parent b275937 commit 95524f3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions stdlib/debug.sn
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@ import std::intrinsics;

/**
* @brief An utility function to raise a debug breakpoint.
* @note If a debugger is not attached, this function will cause the program to crash.
*
* ```
* import std::debug;
*
* public func main() i32 {
* debug::trap();
* return 0;
* }
* ```
*
* @see https://learn.microsoft.com/en-us/cpp/intrinsics/debugbreak?view=msvc-170 (It works across all platforms)
*/
@inline
public func trap() { intrinsics::debugbreak(); }

0 comments on commit 95524f3

Please sign in to comment.