Many C ++ books advise us that C language macros are the first of all evil, but things are not as bad as we think, just like Goto. MacroA major role is to automatically generate code for us. If the template can generate various types of code (type replacement) for us ),In fact, macros can generate new Code (replacement and addition of symbols) on the symbols ).
You can find some macro Syntax problems on Google. Believe me, you do not know as much about macros as you think. If youIf you do not kn
Referrence:
Http://gcc.gnu.org/onlinedocs/cpp/Argument-Prescan.html#Argument-Prescan
Procedure
Macro_expand (macro (argv)/* macro extension process with parameters. The macro is macro and the parameter is argv */{/*. If the macro is defined as a macro containing, take the argv parameter as a string and substitute it into the macro. The result is displayed. Exit */If (macro contain "#") | (macro contain "##")) {stringified argv | argv pasted wi
to X_1024. (Not to X_TABLESIZE. prescan always does a complete expansion .) # define AFTERX (x) X _ # x # define XAFTERX (x) AFTERX (x) # define TABLESIZE 1024 # define BUFSIZE tablesizet1_afterx (BUFSIZE) expands to X_BUFSIZE, and XAFTERX (BUFSIZE) expands to X_1024. (Not to X_TABLESIZE. prescan always does a complete expansion .) second example: If you want to stringify the result of expansion of a macro
Many C + + books have advised us that C-language macros are the root of all evils, but things are not as bad as we think, like Goto. Macros have a big role in automatically generating code for us. If the template can produce various types of code for us (type substitution), then the macro can actually generate new code for us on the symbol (that is, symbol substitution, increment).
Some of the syntax questions about macros can be found on Google. Believe me, your knowledge of macro is not as mu
Http://tech.e800.com.cn/articles/2009/727/1248665385863_1.html
Many C ++ books advise us that C language macros are the first of all evil, but things are not as bad as we think, just like Goto. MacroA major role is to automatically generateCode. If the template can generate various types of code (type replacement) for us ),In fact, macros can generate new Code (replacement and addition of symbols) on the symbols ).
You can find some macro Syntax problems on Google. Believe me, you do not
Author: Kevin Lynx Source: C ++ blog
From: http://www.kuqin.com/language/20080319/4797.html
Many C ++ books advise us that C language macros are the first of all evil, but things are not as bad as we think, just like Goto. MacroA major role is to automatically generate code for us. If the template can generate various types of code (type replacement) for us ),In fact, macros can generate new Code (replacement and addition of symbols) on the symbols ).
You can find some macro Syntax problems on G
Windows Programming macro development
I have previously written an article about macrosArticle: Summary of preprocessing operators used by macros,This section describes in detail how to launch a macro development in Windows integrated development environment (IDE,
Linux programming macro development
Compile with GCC, G ++ compiler, and use the-P option of the compiler. Assume that there is a source file. CPP, use the following command for macro expansion, you can in. the
to define similar macros:#define LOG (format, ...) printf (format, __va_args__)LOG ("%s%d", str, count);__VA_ARGS__ is a system-predefined macro that is automatically replaced with a parameter list.5. What happens when a macro calls itself? For example:#define TEST (x) (x + TEST (x))TEST (1); What's going to happen? To prevent unrestricted recursive expansion, the syntax specifies that when a macro encounters itself, it stops expanding, which isthat when the test (1) is unfolded, a test is foun
:
# Define log (format,...) printf (format, _ va_args _)
_ Va_args _ is a system preset macro, which is automatically replaced with the parameter list.
5. When a macro calls itself,
# Define test (x) (x + test (x)
What will happen? To prevent unrestricted recursive expansion, the syntax stipulates that when a macro encounters itself, it stops expansion, that is,
When the test (1) is expanded, another test is found during the expansion process, so the test is treated as a general symbol. Test
If you have done multimedia applications, will certainly be distressed, how to obtain the SD card multimedia files. Android is still very powerful, and if you know how to invoke the Android API, everything is OK.
When a cell phone or simulator is powered on, the Android Mediascanner is invoked to scan the SD card and the files in memory. Here is the log information.
Copy Code code as follows:
12-13 15:39:11.062:verbose/mediaplayerservice: Create New Media retriever from PID 34912-13
_string_ (bsp_hard_reversion) # Define sw_version_string _string_ (sw_full_vsersion) static const char hw_rev[] = hw_version_string; Hw_rec Config by boards.hstatic const char fw_rev[] = "8.0.0"; static const char sw_rev[] = sw_version_string; #undef str# undef xstr#undef _string_ OK to here I need the function has been done. Everybody just take a debugging tool to see it, it's OK. Careful study of the implementation of the principle, feel their own understanding of the defini
), where the simulator's simulation environment differs greatly from the real environment. A good simulator can not only effectively fill the real gap, but also meet the requirements of the large sampling of RL algorithm, so it can greatly promote the research and development of RL, as mentioned above sim-to-real[71]. At the same time, this is also a combination of RL and VR technology point. Recently, academia and industry have been exerting their force in this field. The Gazebo, Eurotruck Simu
input array, add the values of the elements before the array to the sum of the elements before the output array, and then write the values to the existing elements of the output array.
1 void scan( float* output, float* input, int length)2 {3 output[0] = 0; // since this is a prescan, not a scan4 for(int j = 1; j
The code is an array of N and executes n addition operations-N is the minimum number of addition operations required to generate a s
)# Define show_macro_content (m) to_string_macro (m)Using namespace STD;Int main (INT argc, char * argv []){Int A = 10;Int * B = ;Cout Cout Cout Cout Cout Cout * B = 100;A_testing_macro (* B );Return 0;}
Code Macro. I after macro expansion
Using namespace STD;Int main (INT argc, char * argv []){Int A = 10;Int * B = ;Cout Cout Cout Cout Cout Cout * B = 100;Printf ("A testing macro with a int argument n = % d! /N ", * B );Return 0;}
2. in Linux, use the GCC, G ++ compil
used to scan a single file
Public Uri Scansinglefile (string path, String volumename, String mimetype) {
try {
Initialize (volumename);
Prescan (path, true);
File File = new file (path);if (!file.exists ()) {return null;}
LastModified is in milliseconds on Files.Long lastmodifiedseconds = file.lastmodified ()/1000;
Always scan the file, so we can return the Content://media Uri for existing filesreturn Mclient.doscanfile (Path, MimeType, L
Contact Us
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.