Created
June 12, 2018 08:24
-
-
Save Araq/9575d2df262d83208092a36ffe06de4b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type | |
SeqHeader = object | |
len, reserved: int | |
proc isLiteral(s: string): bool {.inline.} = (cast[ptr SeqHeader](s).reserved and (1 shl (sizeof(int)*8 - 2))) != 0 | |
proc main(param: string) = | |
echo "param ", isLiteral(param) | |
echo "const ", isLiteral("foobar") | |
main("const here") | |
var x: string = "foo bar" | |
main(x) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment