Comments

Log in with itch.io to leave a comment.

(2 edits) (+2)

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.

(+2)

Thanks a lot for the kind words and for buying the book!

Thank you for the list of issues. I have fixed 2, 3 and 4.

Regarding 1: There is no modern OS that leaks after shutdown. While there are some really old OSes where this could happen, Odin doesn’t support any of those OSes anyways. However, a good reason to do the deallocation at the end is to keep third-party memory analysis programs, such as Valgrind, happy. I have added a note about that in the book (update coming later today or tomorrow).

(+3)

After many years coding in C and C++ I decided to switch to Odin. I've watched a couple of your videos on YouTube and decided to buy a book. Enjoying it so far. Thank you very much!

Its definitely better to buy this book to learn Odin than trying to search for brief pieces of information on this language on the internet.

(+2)

Thoroughly enjoying the book so far! Very approachable and informative.

(3 edits) (+3)

Hey Karl, the book is fantastic, I have learned so much about this language even in the space of a few days. One observation I wanted to ask, in section 10.2.5 you illustrate an application for maps by building a set, and say that Odin doesn't have any special support for sets, but I thought bit sets were exactly that?

https://odin-lang.org/docs/overview/#bit-sets

It even supports "overloading" of operators so you can do unions and such. Is there a fundamental difference here? Thanks again for such a great book!

EDIT: D'oh, my bad, your set example using a map allows sets of arbitrary type whereas bitsets are more limited. Never mind!

(1 edit) (+3)

Thank you! It’s great that you inform me about this confusion, because I should really make sure to stress the difference between them. After all, they both contain the word “set”. I’ll add fixing this to my TODO list.

(1 edit) (+3)

The updated version (https://zylinski.itch.io/odinbook/devlog/848116/version-12-new-section-on-address-sanitizer-and-lots-of-small-fixes ) has fixed this.

(+6)

Read three pages and zero cats. Disappointed.
Well-written, easy to read and even to understand (sometimes). I like it a lot. 

(+3)

Thanks 😻

(1 edit) (+8)

As far as I’ve read, the book is great , well structured and well written. It’s a must have for all the Odin programmers, ans perhaps for all the programmers who want to discover the great coding language that Odin Is.

(1 edit) (+3)

Thank you! Happy that you like it

(+7)

I've just barely started it and I'm already loving it! Everything is organized clearly and beautifully, explanations are easy to follow with nice illustrations that help a lot!

(+2)

Thank you 💖

(+8)

Such a well-written and beautifully-designed book on Odin! Thank you for your hard work!

(+2)

Thanks for the kind words!