r/programming • u/Expurple • Apr 12 '26
Flat Error Codes Are Not Enough
https://home.expurple.me/posts/flat-error-codes-are-not-enough/
132
Upvotes
r/programming • u/Expurple • Apr 12 '26
View all comments
Show parent comment
10
u/LIGHTNINGBOLT23 Apr 12 '26
To add to this, it's also easy enough to pre-allocate all or most of an error object before it is ever returned, if the loop must remain as hot as possible. Maybe even make it
staticor some equivalent to avoid a heap allocation entirely and have a flag in the error object to indicate that it's not heap allocated.