Odin Programming Language
#reverse for
for &e, i in array
and for k, &v in map
and switch &v in ...
&e
value will still be of the same type but will be addressable (a reference to the actual value)
intrinsics.type_merge
ODIN_COMPILE_TIMESTAMP
(unix timestamp in nanoseconds)panic
allocator for wasm targetsio.Stream
interface - details
core:math/cmplx
vendor:fontstash
vendor:nanovg
math.sincos
vendor:darwin
packages@(require_results)
to many procedures within core
math
procedures "contextless"
Mutex
to mem.Tracking_Allocator
bindFramebuffer
was added to WebGL
packageself_cleanup
flag to properly auto-clean threadscore:fmt
for ODIN_ERROR_POS_STYLE
-max-error-count:<integer>
intrinsics.alloca
struct #no_copy
to prevent trivial copying in certain cases@(deferred_*_by_ptr=<proc>)
attributes-use-separate-modules
due to type determination in the backend!x
be an untyped boolean-debug
, the compiler now defaults to -o:none
unless explicitly specifiedvendor:lua
vendor:lua/5.1
vendor:lua/5.2
vendor:lua/5.3
vendor:lua/5.4
append
with zero sized typesfmt.fprint*
related calls using a bufio.Writer
bit_array.unsafe_get
/bit_array.unsafe_set
core:text/edit
case nil
within a type switch statement-o:none
optimization mode (useful for -debug
builds)-debug
builds-no-thread-local
flag@(extra_linker_flags=<string>)
attribute for foreign import
vendor:raylib
version 4.5core:text/table
core:net
strconv.parse_f64_prefix
strings.split_multi_iterator
core:image
packages work on js
platform by not requiring core:os
context.temp_allocator
Implementation
free_all(context.temp_allocator)
must be called to clear the contents of the internal arena (unlike the previous ring buffer)
expand_values()
struct
or fixed-length array into multiple valuesFoo :: struct {x: f32, y: i32}
f := Foo{1, 2}
a, b := expand_values(f)
assert(a == 1 && b == 2)
struct{}
and union{}
using
in a compound literalFoo :: struct {
using x: struct { // named `using` fields
y: int,
},
z: f32
using _: struct { // anonymous `using` fields
w: bool,
},
}
f := Foo{
y = 123, // equivalent to `x = {y = 123},`
z = 456,
w = true,
}
-terse-errors
set ODIN_TERMINAL=ansi
to force ANSI colouring@(fini)
to complement its opposite @(init)
byval
parameters on Darwin SysV ABI which in turn fixes #by_ptr
runtime.Type_Info_Parameters
for procedures inputs and outputs@(deferred_*)
time.tsc_frequency()
core:mem/virtual
's Arena
free_all
free all memory blocks except for the first onevirtual.arena_destroy
will free all memory blocks including the first one (assuming Growing or Static)#optional_allocator_error
to make_map
vendor:directx
packagesBlockingMutex
with RwMutex
RecursiveMutex
with BlockingMutex
-use-separate-modules
is used
-use-separate-modules
turns each package into a separate translation unit (object file) and then links them all together. This allows LLVM be multithreaded at the translation unit stage (LLVM Module).-use-separate-modules
will not produce as good code compared to without it because of the multiple translation units.StringMap
, StringSet
, PtrMap
, PtrSet
)auto_cast
from procedure parameterswhen
statements within foreign
blocks at the file scopecore:mem/virtual
Arena_Temp
improvements
arena_temp_ignore
allowing for ignoring of a temporary section if necessarycore:text/match
sync
calls contextless
where possiblesync.once_do
os.get_last_error
contextlesscore:fmt
map
: High performance, cache-friendly, open-addressed Robin Hood hashing hash map data structure with various optimizations for Odin
alloc_non_zeroed
and free
internallyruntime.Map_Info
) for dynamic calls.delete_key
whilst iterating across the mappkg::name
, or name
if built-in (or the initial package for convenience)-default-to-nil-allocator
also enabled -no-dynamic-literals
intrinsics.ptr_sub
code generationvendor:cgltf
Allocator_Mode.Alloc_Non_Zeroed
bit_set
for flags where possible instead of just an enum
core:math
procedures in native Odinmath.pow10
strings.write_(f16|f32|f64)
user_data: rawptr
to filepath.Walk_Proc
-
raw_data
an intrinsic rather than a @(builtin)
runtime proceduretransmute
to be constant for integers of the same internal endianness#defined(I)
which
and complain if not found-opt
flaglb_find_ident
when possible#caller_location
and #location
to use read only data section where possibleodin help
for -define
-minimum-os-version
for Darwin targets, e.g. -minimum-os-version:12.0.0
-target-features
flag to force extra LLVM options-
core:sys/info
Static_Arena
and Growing_Arena
into Arena
core:mem/virtual
in generalN = -1
in wstring_to_utf8
core:math/rand.choice
time.now()
and os.File_Info
cap(Enum)
, equivalent to max(Enum)-min(Enum)+1
ODIN_BUILD_PROJECT_NAME
constant//+build-project-name
build directiveintrinsics.type_convert_variants_to_pointers
helgrind
and valgrind
supportuint
instead of int
to improve bounds checking code generation#optional_second
with #optional_allocator_error
intrinsics.count_{ones,zeros,trailing_zeros,leading_zeros}
work at compile timemap
help
command, so you can now use odin help build
in addition to odin build -help
odin report
vendor:zlib
core:debug/pe
to parse PE filescore:sys/info
to query CPU, GPU, RAM, etc.core:c
max(i32)
on Darwincore:encoding/json
core:strconv
map_insert
libc.aligned_alloc
slice.enumerated_array
core:sys/windows
core:libc
map
svendor:stb/image
vendor:directx
core:mem/virtual
handling of out of memory on Windowscore:io
by removing different unnecessary types and callsabs
, clamp
, min
, max
to core:math
as aliases#soa
pointer type to ad with refactory to #soa
data types
#soa ^#soa[]T
unreachable()
a built-in compiler-level procedurefoo() or_else unreachable()
or other diverging procedures#load
can now optionally import the loaded file data as a different type than []u8
#load(path)
#load(path, []T)
(where T
is a type that can be trivially loaded from memory (i.e. no pointers))#load(path, string)
(shorthand for string(#load(path))
)#load_or(path, default)
in favour of #load(path) or_else default
#load(path1) or_else #load(path2)
delete
, when possible, to improve tracking informationx->y()
calls in Odinvendor:commonmark
core:image/tga
can now load as wellmath.divmod
and math.floor_divmod
core:encoding/json
vendor:directx/d3d11
packagecore:container/queue
helpers and peek_front
and peek_back
reflect.get_union_variant
slice.sort_with_indices
family of proceduressync.Futex
support on windowscore:sys/valgrind
package for valgrind, memcheck, and callgrind