Ziggit

Prevent Zig from reordering instructions (opens in new tab)

Is there any way currently to prevent the Zig compiler from “optimizing” by reordering function calls? const res = funcWithSideEffects(); dealWithSideEffects(); return res; In this snippet I’d expect the first function to always be executed first, which happens in Debug mode but in certain architectures in release does not. Note: the non-generic context has to do with calling a FPU instruction called rint that can set an exception flag on the FPU which Zig does not known about, so it thinks ...

Read the original article
Sign in to keep reading the full article.

Keyboard Shortcuts

Navigation

Next / previous post
j/k
Open post
oorEnter
Preview post
v

Post Actions

Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Save / unsave
s

Recommendations

Add interest / feed
Enter
Not interested
x

Go to

Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Discover
gb
Search
/

General

Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help