Although Odin is rather a simple programming language, there are elements that one could find not so obvious and straightforward. This book helps to dispel misunderstandings and incorrect assumptions about Odin's inner behavior. And, honestly, it's neat to have such condensed source of information on hand, considering modest popularity of the language and lack of literature besides official overview and occasional articles.
That said, I have several nitpicks:
1) I think that not freeing memory in the end of a program is not generally a good advice, since, I believe, there are some OSes that do not free memory once a program is terminated.
2) In chapter 13.2
destroy_level :: proc(level: Level) { vmem.arena_destroy(&level.arena) }
should be
destroy_level :: proc(level: ^Level) { vmem.arena_destroy(&level.arena) }
since you'd get
Error: Cannot take the pointer address of 'level.arena'
otherwise.
3) In chapter 18.4
If you want a file to not compile on macOS and not compile on Linux, then add this to the top of the file:
#+build !windows #+build !linux
should probably be
#+build !darwin #+build !linux
4) In chapter 12.4
if logh_err == os.ERROR_NONE { log.destroy_file_logger(logger) os.close(logh) }
there is no need to close handle, because
log.destroy_file_logger(logger)
looks like
destroy_file_logger :: proc(log: Logger, allocator := context.allocator) { data := cast(^File_Console_Logger_Data)log.data if data.file_handle != os.INVALID_HANDLE { os.close(data.file_handle) } free(data, allocator) }
and calling
os.close(logh)
may lead to the
An invalid handle was specified.
error.