Skip to content

Chapter 17.3 DSL: Curly braces in macro invocation #1956

Description

@Feliksas

in this code snippet

macro_rules! calculate {
    (eval $e:expr) => {
        {
            let val: usize = $e; // Force types to be unsigned integers
            println!("{} = {}", stringify!{$e}, val);
        }
    };
}

what is the implication of using curly braces with stringify! ? Looks like those do not change program behaviour in any way, compared to normal parentheses.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions