macros

What types of Macros/Syntax Extensions/Compiler Plugins are there?

独自空忆成欢 提交于 2020-01-21 06:32:05
问题 I am very confused by the many terms used for several macro-like things in the Rust ecosystem. Could someone clarify what macros/syntax extensions/compiler plugins there are as well as explain the relationship between those terms? 回答1: You are right: it is confusing. Especially, because most of those features are unstable and change fairly often. But I'll try to summarize the current situation ( December 2016 ). Let's start with the Syntax Extension : it's something that has to be "called" or

Viewing compiler expanded code - C++

試著忘記壹切 提交于 2020-01-21 04:15:28
问题 I learned that compiler will expand macros while compiling. Templates are also expanded at the compile time. Is there any way to see this expanded code? I am compiling using Visual Studio 2008. any thoughts? 回答1: The VC++ compiler (cl.exe) supports a few command line switches for this: /E preprocess to stdout /P preprocess to file /EP preproscess to stdout with no #lines Additional command-line switches can be added in your project properties. In my version (VC2005), Configuration Options ->

Preprocessor Macro not working on Windows in Fortran Code

北战南征 提交于 2020-01-20 08:50:09
问题 Dear All I have a small Fortran program containing preprocessor macro. Below is a minimal example. On mac os x, it works well but when I compile it on windows 7 (64-bit) it always prints unknown operating system . I am using gfortran-4.8.0 (mingw32) on windows 7. program foo implicit integer(i-n), double precision (a-h,o-p), + character*8(x-z) * #ifdef _WIN64 zterm = 'wxt' #elif _WIN32 zterm = 'wxt' #elif __APPLE__ zterm = 'aqua' #elif __linux zterm = 'x11' #elif __unix zterm = 'x11' #elif _

SAS IML use of Mattrib with Macro (symget) in a loop

淺唱寂寞╮ 提交于 2020-01-17 08:22:07
问题 In an IML proc I have several martices and several vectors with the names of columns: proc IML; mydata1 = {1 2 3, 2 3 4}; mydata2 = {1 2, 2 3}; names1 = {'red' 'green' 'blue'}; names2 = {'black' 'white'}; To assign column names to columns in matrices one can copypaste the mattrib statement enough times: /* mattrib mydata1 colname=names1;*/ /* mattrib mydata2 colname=names2;*/ However, in my case the number of matrices is defined at execution, thus a do loop is needed. The following code

SAS IML use of Mattrib with Macro (symget) in a loop

会有一股神秘感。 提交于 2020-01-17 08:22:06
问题 In an IML proc I have several martices and several vectors with the names of columns: proc IML; mydata1 = {1 2 3, 2 3 4}; mydata2 = {1 2, 2 3}; names1 = {'red' 'green' 'blue'}; names2 = {'black' 'white'}; To assign column names to columns in matrices one can copypaste the mattrib statement enough times: /* mattrib mydata1 colname=names1;*/ /* mattrib mydata2 colname=names2;*/ However, in my case the number of matrices is defined at execution, thus a do loop is needed. The following code

SAS IML use of Mattrib with Macro (symget) in a loop

独自空忆成欢 提交于 2020-01-17 08:22:06
问题 In an IML proc I have several martices and several vectors with the names of columns: proc IML; mydata1 = {1 2 3, 2 3 4}; mydata2 = {1 2, 2 3}; names1 = {'red' 'green' 'blue'}; names2 = {'black' 'white'}; To assign column names to columns in matrices one can copypaste the mattrib statement enough times: /* mattrib mydata1 colname=names1;*/ /* mattrib mydata2 colname=names2;*/ However, in my case the number of matrices is defined at execution, thus a do loop is needed. The following code

VBA to change the name of the Activex button

ⅰ亾dé卋堺 提交于 2020-01-17 05:43:06
问题 I am not sure, even if this is possible. I would like to change the named of the button when clicked. I have Active X button that will enable cells on the sheet when clicked. Name of the button "Enable Sheet". Once he enables, he should see a button "Disable Sheet". Please advise. 回答1: assuming your button is named after "CommandButton1": Private Sub CommandButton1_Click() With Me.OLEObjects("CommandButton1").Object .Caption = IIf(.Caption = "Enable Sheet", "Disable Sheet", "Enable Sheet")

VBA/Macro to copy random rows based on multiple conditions

穿精又带淫゛_ 提交于 2020-01-17 05:29:14
问题 I need help to be able to get random rows from another workbook with specific conditions: If i click a button/run a macro, I should get something like this : 4 random rows for all rows that has "AU" 1 random row for all rows that has "FJ" 1 random row for all rows that has "NC" 3 random rows for all rows that has "NZ" 1 random row for all rows that has "SG12" ALL FROM Raw Data_Park Sampling.xlsx " Sheet1 " sheet and paste it to Park Sampling Tool.xlsm " Random Sample " sheet. All should

How to get a raw sequence of reified values in scala macro

白昼怎懂夜的黑 提交于 2020-01-17 05:22:34
问题 I have a c.Expr[Seq[T]] and I want to get a Seq[c.Expr[T]] so I can pass it to a library function that processes it and produces a different final result Expr. I found this answer explaining how to go in the opposite direction but I can't quite figure out how to invert the process. reify { xs.splice.map(x => reify { x }) } gives me c.Expr[Seq[c.Expr[T]]] , which isn't quite right. 来源: https://stackoverflow.com/questions/39761482/how-to-get-a-raw-sequence-of-reified-values-in-scala-macro

How to write a macro in Rust to match any element in a set?

拟墨画扇 提交于 2020-01-17 04:58:08
问题 In C, I'm used to having: if (ELEM(value, a, b, c)) { ... } which is a macro with a variable number of arguments to avoid typing out if (value == a || value == b || value == c) { ... } A C example can be seen in Varargs `ELEM` macro for use with C. Is this possible in Rust? I assume it would use match . If so, how would variadic arguments be used to achieve this? 回答1: macro_rules! cmp { // Hack for Rust v1.11 and prior. (@as_expr $e:expr) => { $e }; ($lhs:expr, $cmp:tt any $($rhss:expr),*) =>