Repository navigation
Category Tiko Compiler Define
Home › All Categories › TIKO_COMPILER
tiko defines __TIKO_COMPILER__, always 1:
#ifdef __TIKO_COMPILER__
print "tiko"; __TIKO_COMPILER__ '' tiko prints: tiko 1
#else
print "not tiko" '' another compiler prints this
#endifTest it with #ifdef or defined( ), so that a compiler which does not define it takes the other branch rather than stopping:
#import "std/containers"
#ifdef __TIKO_COMPILER__
dim names as containers.Array( of ustring ) '' tiko builds this
#else
dim names(0 to 63) as string '' another compiler builds this
#endifComparing the VALUE is not a portable guard: #if __TIKO_COMPILER__ = 1 fails on a compiler that does not define the name.
__FB_MIN_VERSION__ is not defined by tiko, so #if __FB_MIN_VERSION__( 1, 20, 0 ) is an error under tiko:
error TKO0308: invalid expression in '#if'
tiko defines one TIKO_OS_ name for the target being built, always 1:
| Target | Defined | Not defined |
|---|---|---|
windows-x86_64 |
TIKO_OS_WINDOWS |
TIKO_OS_LINUX, TIKO_OS_MACOS
|
linux-x86_64 |
TIKO_OS_LINUX |
TIKO_OS_WINDOWS, TIKO_OS_MACOS
|
macos-arm64 |
TIKO_OS_MACOS |
TIKO_OS_WINDOWS, TIKO_OS_LINUX
|
The name follows -target, not the machine running the compiler, so -target linux-x86_64 on Windows takes the Linux branch:
#ifdef TIKO_OS_WINDOWS
print "windows"; TIKO_OS_WINDOWS '' windows-x86_64 prints: windows 1
#elseif defined( TIKO_OS_LINUX )
print "linux"; TIKO_OS_LINUX '' linux-x86_64 prints: linux 1
#elseif defined( TIKO_OS_MACOS )
print "macos"; TIKO_OS_MACOS '' macos-arm64 prints: macos 1
#else
print "other"
#endifExactly one of the three is defined on every target.
| Define | tiko |
|---|---|
__TIKO_COMPILER__ |
1 |
__TIKO_VERSION__ |
"0.1.0-dev" |
__FB_VERSION__ |
"1.20.0" |
__FB_SIGNATURE__ |
"tiko-lang" |
__FB_BACKEND__ |
"llvm" |
__FB_MIN_VERSION__ |
not defined |
TIKO_OS_WINDOWS |
1 on windows-x86_64, otherwise not defined |
TIKO_OS_LINUX |
1 on linux-x86_64, otherwise not defined |
TIKO_OS_MACOS |
1 on macos-arm64, otherwise not defined |
TIKO_ARCH_X86_64 |
1 on windows-x86_64 and linux-x86_64, otherwise not defined |
TIKO_ARCH_ARM64 |
1 on macos-arm64, otherwise not defined |
__TIKO_COMPILER__ says which compiler is building; __TIKO_VERSION__ says which version of it. Neither says which features it has, so code that must build with several versions still tests more than one symbol.
tests/pp/tiko-compiler-define.test holds the define and its value; tests/pp/tiko-target-defines.test holds the TIKO_OS_ and TIKO_ARCH_ names on each target.
- Compatibility — compatibility notes
- Feature Index — the language features these guards protect
-
__FB_VERSION__·__FB_SIGNATURE__·__FB_BACKEND__ - Intrinsic Defines — the full list
Category: TIKO_COMPILER Kind: intrinsic define
tiko-lang · Home · Feature Index · Keyword Index · License
FreeBASIC manual pages reproduced under the GNU FDL 1.3.
- Generics
- Interfaces
- For Each
- Iterators
- Tuples
- Array Results
- Defer
- Lambdas
- Block Strings
- String Slices
- Embed
- Typed Variadics
- C Header Import
- Foreign Library Linking
- UString
- Fixed-Width Types
- Nullptr
- String Library
- Format
- Array
- Map
- Set
- LinkedList
- OrderedMap
- OrderedSet
- Sorting
- Optional
- Result
- Smart Pointers
- Date and Time (Chrono)
- Filesystem
- File Streams
- Config (INI and TOML)
- Codec
- Hash
- UUID
- OS
- Process
- Net
- HTTP and TLS
- Math Library
- Finance
- Logging
- Terminal TUI Library
- PsControls
- tkControls
- sys/win
- Goroutines and Channels
- LLVM Backend
- tiko build
- TIKO_COMPILER
- Variable Declarations
- Standard Data Types
- User Defined Types
- Procedures
- Operators
- Control Flow Statements
- Converting Data Types
- Array Functions
- String Functions
- Mathematical Functions
- Bit Manipulation
- Date and Time Functions
- File I/O Functions
- Console Functions
- User Input (Runtime Library)
- User Input Functions (Graphics Library)
- Screen Functions
- 2D Drawing Functions
- Graphics Library Reference
- Graphics Keyword List
- Memory Functions
- Threading Support Functions
- Error Handling Functions
- Operating System Functions
- Preprocessor
- Intrinsic Defines
- Miscellaneous Keywords
- Modularizing