this post was submitted on 28 Sep 2024
53 points (98.2% liked)

Rust

6022 readers
1 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

[email protected]

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS
 

A short post on how variable names can leak out of macros if there is a name collision with a constant. I thought this was a delightful read!

you are viewing a single comment's thread
view the rest of the comments
[–] arendjr 2 points 1 month ago (1 children)

Runtime performance is entirely unaffected by the use of macros. It can have a negative impact on compile-time performance though, if you overdo it.

[–] livingcoder 3 points 1 month ago (1 children)

I understand that the macro only affects compile time but I'm talking about the extra function that's included in the resulting source code when the macro is expanded during compile. Based on other feedback, it looks like the unused function is optimized away.

[–] arendjr 2 points 1 month ago

Ah yes, exactly.