#Inline call is recursive

1 messages · Page 1 of 1 (latest)

vapid garden
#

How do I force it to call the function?

uneven lotus
#

what does this mean 😄
the inline call is not recursive

#

again, depends exactly what you mean

#

please be more specific

wraith crown
#
inline fn foo() void {
    foo();
}

this errors with error: inline call is recursive

#

the answer is you dont because that doesnt make much sense

uneven lotus
#

oh yes of course

wraith crown
#

it would create an infinitely big binary

vapid garden
#

I see

#

I first defined said function as inline and called it in majn

#

it works just fine, but it refuses to work when I called it from another function

uneven lotus
#

@wraith crown would this be valid:

pub fn main() !void {
    @call(.always_inline, foo, .{});
}

fn foo() void {
    foo();
}```
?
wraith crown
#

oh thats interesting

#

i guess it should

uneven lotus
#

oh it causes a segsegv

wraith crown
#

lol

uneven lotus
wraith crown
#

at runtime?

uneven lotus
#

yes

wraith crown
#

yeah that makes sense, only the top level call is inline then it just recurses infinitely which segfaults