Always pleased to see Typst mentioned. TeX made a lot of choices that made sense at the time, but TeX macros and C #defines especially when nested and/or not properly bracketed to allow nesting are a mess when things go wrong.
In what setting are you mixing LaTeX and C code?
In what setting are you mixing LaTeX and C code?