Macros and functions and comparisons in C + +:1, frequent use and perform simple calculations can use macros, and other more cumbersome, complex programs can be implemented with functions.2, the macro definition is independent of the type, and the function needs to pay attention to the type of parameters.3, the name of the macro definition is all uppercase, and the function name is the use of letters and "_
]bounds]. size.width==320.0f[[uiscreenmainscreen]bounds].size.height ==568.0f// Judging whether it is iphone6/6s#defineiphone6_6s[[uiscreenmainscreen] Bounds].size.width==375.0f[[uiscreenmainscreen]bounds]. size.height==667.0f// Judging whether it is iphone6plus/6splus#defineiphone6plus_6splus[[ uiscreenmainscreen]bounds].size.width==414.0f[[uiscreen Mainscreen]bounds].size.height==736.0f//getting the system version #defineios_system_version[[[uidevicecurrentdevice] Systemversion]floatvalue]14.
In iOS development, it is often used to define macros, or to modify some data types with const, and often developers do not know how to use them correctly, resulting in the confusion of macros and const decorations in the project.Can you tell the difference between the following? Do you know when to use it?#define Hscoder @ "Hansha haha"NSString*hscoder = @"Hansha haha";extern NSString*hscoder;extern Const
Use of trace macros in C + +
Trace macro for VC under the program debugging is very useful things, with a similar function of printf, the macro is only in the debug version of the program appears, when the release of the macro disappears completely, thus helping you debug also in the release of the time to reduce the amount of code.The use is very simple and the format is as follows:TRACE ("ddddddddddd");TRAC
Macros are a collection of commands and are widely used, including the word editor in MS Office, the Excel editor and various text editors, and Vim, one of the most powerful text editors in Linux systems, also supports macro operations, and this section briefly describes the use of macros in Vim, First look at the following macro commands
q* Start Recording mac
In Word, although it's not easy to create macros, it's really easy to run a macro, just like a program has been created, so we just need to turn on the switch, so what's the simple step?
Word
1, click Macros from the Macros submenu on the Tools menu.
2. In the Macro name box, click the macro: an action or a set of actions that you can use to automate ta
There are several main differences between enumerated constants and macros:
1. an enumerated constant is one of the entities, but the macro is not an entity;
2. an enumerated constant is a constant, but a macro is not a constant;
3. an enumerated constant has a type, but the macro has no type, and the enumeration variable has the same scope, value, and other properties as the normal variable, but the macro is not, and the macro is not part of the l
It is not convenient to invoke macros by running the Macros dialog box, call macros through shortcut keys, and if you can't remember the macros, add a button.
If the macro is valid only for the current workbook document, I recommend that you add a form command button to the workbook document to invoke the macro:
1. E
Open Word 2003, click the Tools menu, point to Macros, and then click Macros on the next Level menu.
In the Macros list box, click the name of the macro you want to delete, and then click the Delete button on the right
Pop-up the "Delete Macros" prompt dialog box, click Yes
The Cl
C ++ macros and enumeration, enumerationMacro
Our calculator program uses 1234 for addition, subtraction, multiplication, and division, which makes reading a little difficult. After a month, you may not be able to remember whether the code is 0123 or 1234. You still have to search for it in the Code. If you can get a meaningful alias for the four numbers representing the four arithmetic operations, first, you know what it is. No problem. Use
"Hot Questions-Extended learning"
Inline constenum macros
"C + + can use technology to replace macros"The inline of C + + is an improvement to the C function macro, the const substitution macro constants.inline overrides are provided for function macro C + +. try to replace the macro with a const, Enum,inline. --"Effective C + +" clause 2Advantages of macros
Some pre-defined macros in the C standardSome predefined macros are specified in the C standard and are often used for programming. The following table is a list of some of the predefined macros that are often used.MacroSignificance__date__Date of preprocessing (string literal in the form "MMM DD yyyy")__file__string literal representing the current source code f
We encounter many macro definitions during development in the vs environment. These macros can be applied to code or used for compilation, engineering options, and other settings, in short, it is an essential tool in our development, and it is necessary to make a summary. Some macros are defined in C/C ++, and some macros are predefined in the VC environment.
1.
A major function of macros is to automatically generate code for us. If the template can generate various types of code (type replacement) for us, the macro can actually generate new Code (that is, replacing and adding symbols) for us on the symbol ).
1. Macros can be defined like functions.
2. if a macro requires a parameter, you can skip it. The compiler will warn you (the macro parameter is not enough)
From: http://blog.csdn.net/strikebone/archive/2007/11/02/1863523.aspx
Here is a question about macros. I have used ATL's String Conversion macros, including w2a, which I don't quite understand at first. To use these macros, you must use uses_conversion at the beginning of the function to initialize some local variables. Use it, but let's look at the macro defini
1. Macro is a replacement that is completed by the C Preprocessor before compilation.
2. Differences between macro text replacement and typedef:
For example, the difference between typedef int X [10] And # define x int [10]
(1) The macro type name can be extended with other type specifiers, but the type name defined by typedef cannot.
Eg,
# Define peach int
Unsigned Peach I;/* No problem, pai_^ */typedef int banana;
Unsigned banana I;/* error, invalid, */(2) when several variables are declared
The ansi c standard has several predefined macros: __file _ date _ time ___ _ line _.
_ Line __: inSource codeInsert Current SourceCodeRow number;
_ File __: insert the name of the current source file into the source file;
_ Date __: Insert the current compilation date into the source file
_ Time __: Insert the current compilation time into the source file;
_ Stdc __: when requiredProgramWhen the ansi c standard is strictly followed, this id
Excel2003 Tutorial 60, how to record the Macros command in Excel.
Demo Animation
Operation Steps
It's perfectly OK to say, "Macros" is the essence of Excel, how to record a macro?
Let's take a look at the specific recording process by recording a macro with a setting heading "Center Across columns":
Execute the tools → macros → record new Macro comman
Excel2003 Tutorial 57, create a Form command button with macros.
Demo Animation
Operation Steps
It's not easy to call macros by running the Macros dialog box, call macros through shortcut keys, and if you can't remember a lot of macros, let's add a button to the Ex
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.