macros

“cannot find value `a` in this scope” in Rust macro

给你一囗甜甜゛ 提交于 2021-01-27 17:21:59
问题 I created macro for printing, using proc-macro-hack. Then this error occured though I already have defined a . Following is the code. On decl crate, proc_macro_expr_decl! { /// Function for printing to the standard output. /// /// First argument can be literal or not literal. gprint! => gprint_impl } On impl crate, use syn::{Expr, ExprTuple, parse_str}; use quote::ToTokens; fn _print_impl(input: &str, print_name: &str) -> String { let mut input_with_parens = String::with_capacity(input.len()

“cannot find value `a` in this scope” in Rust macro

一笑奈何 提交于 2021-01-27 17:17:46
问题 I created macro for printing, using proc-macro-hack. Then this error occured though I already have defined a . Following is the code. On decl crate, proc_macro_expr_decl! { /// Function for printing to the standard output. /// /// First argument can be literal or not literal. gprint! => gprint_impl } On impl crate, use syn::{Expr, ExprTuple, parse_str}; use quote::ToTokens; fn _print_impl(input: &str, print_name: &str) -> String { let mut input_with_parens = String::with_capacity(input.len()

What does “macro annotations embedding in comments” mean in mcpp?

断了今生、忘了曾经 提交于 2021-01-27 13:15:54
问题 In mcpp.exe --help Options available with only -@std (default) option: -@compat Expand recursive macro more than Standard. -3 Enable trigraphs. -K **Output macro annotations embedding in comments.** So, what does 'macro annotation in comments' mean? http://mcpp.sourceforge.net/ 回答1: From the mcpp-summary-272.pdf file available at SourceForge (link in question): Also mcpp has a mode to output macro informations embedded in comments. This mode allows you to know macro calls and their locations

Macro Operator List

99封情书 提交于 2021-01-27 11:28:10
问题 I know about Macro's Stringizing operator ( # ) and I recently learned about the ( ## ) Concatenation operator: Preprocessor Stringizing Operator with String Literal Prefixes Are there any other macro operators that are available to me? I know that Boost has a pretty extensive suite that they've put together, however for the purposes of this question I'm just asking about Macro operator support defined by the standard. 回答1: As is mentioned by Cyber's comment the Sringizing ( # ) and

Macro Operator List

拈花ヽ惹草 提交于 2021-01-27 11:26:30
问题 I know about Macro's Stringizing operator ( # ) and I recently learned about the ( ## ) Concatenation operator: Preprocessor Stringizing Operator with String Literal Prefixes Are there any other macro operators that are available to me? I know that Boost has a pretty extensive suite that they've put together, however for the purposes of this question I'm just asking about Macro operator support defined by the standard. 回答1: As is mentioned by Cyber's comment the Sringizing ( # ) and

Macro Operator List

蹲街弑〆低调 提交于 2021-01-27 11:25:24
问题 I know about Macro's Stringizing operator ( # ) and I recently learned about the ( ## ) Concatenation operator: Preprocessor Stringizing Operator with String Literal Prefixes Are there any other macro operators that are available to me? I know that Boost has a pretty extensive suite that they've put together, however for the purposes of this question I'm just asking about Macro operator support defined by the standard. 回答1: As is mentioned by Cyber's comment the Sringizing ( # ) and

macro definition containing #pragma

ぐ巨炮叔叔 提交于 2021-01-27 10:26:18
问题 I am trying to define the following macro: #if defined(_MSC_VER) #define PRAGMA_PACK_PUSH(n) __pragma(pack(push, n)) #define PRAGMA_PACK_POP() __pragma(pack(pop)) #else #define PRAGMA_PACK_PUSH(n) #pragma (pack(push, n)) #define PRAGMA_PACK_POP() #pragma (pack(pop)) #endif But i get the following error on Linux - error: '#' is not followed by a macro parameter #define PRAGMA_PACK_PUSH(n) #pragma (pack(push, n)) and it points to the first ')' in the statment How can i define a macro that

Macro stepper in DrRacket

拟墨画扇 提交于 2021-01-27 08:00:49
问题 On the link http://www.ccs.neu.edu/home/ryanc/macro-stepper/tutorial.html there are instructions for working with the macro stepper. However, when I'm going to try it, I can't get the second expansion of myor in the definition of nonzero? function, only the first. Also, I have no buttons "Previous term" and "Next term". So my question is: how i must configure macro stepper to get the second expansion, like in tutorial? 回答1: I'm assuming that your source program looked something like this:

Macro stepper in DrRacket

一笑奈何 提交于 2021-01-27 07:54:50
问题 On the link http://www.ccs.neu.edu/home/ryanc/macro-stepper/tutorial.html there are instructions for working with the macro stepper. However, when I'm going to try it, I can't get the second expansion of myor in the definition of nonzero? function, only the first. Also, I have no buttons "Previous term" and "Next term". So my question is: how i must configure macro stepper to get the second expansion, like in tutorial? 回答1: I'm assuming that your source program looked something like this:

Macro stepper in DrRacket

倖福魔咒の 提交于 2021-01-27 07:52:50
问题 On the link http://www.ccs.neu.edu/home/ryanc/macro-stepper/tutorial.html there are instructions for working with the macro stepper. However, when I'm going to try it, I can't get the second expansion of myor in the definition of nonzero? function, only the first. Also, I have no buttons "Previous term" and "Next term". So my question is: how i must configure macro stepper to get the second expansion, like in tutorial? 回答1: I'm assuming that your source program looked something like this: