Nov 20, 2021
I've been doing a lot of "differential debugging" on the Lua codebase lately. There's something going off the rails in a part of Teliva that I don't understand yet. I try to make my change in a temporary copy of the unmodified Lua sources and step through to see, what is the control flow supposed to look like? Then I compare with what's happening in Teliva. Where does it go off the rails? Super useful to have working software that is so easy to compile.
I've been programming in C++ for a long time, and just ran into a very surprising situation in C.

$ cat x.c
inline int foo(void) {
  return 42;
}

int main(void) {
  return foo();
}

$ gcc -c x.c
$ gcc x.o
undefined reference to 'foo'

$ gcc -O1 -c x.c
$ gcc x.o
# no error

If you compile without optimizations, the `inline` keyword does nothing -- but the function is still excluded from the object file.

This post is part of my Freewheeling Apps Devlog.

Comments gratefully appreciated. Please send them to me by any method of your choice and I'll include them here.

archive
projects
writings
videos
subscribe
Mastodon
RSS (?)
twtxt (?)
Station (?)