In the development process, we not only have to look at other people's code, but also let others see our code. Then, having a good coding habit will be very important. The following is a list of coding recommendations for developing iOS using OBJECTIVE-C."1"The length of any function must not exceed 50 lines. (In fact, it's easy to get over 50 lines, so consider
Original link: http://blog.csdn.net/myaccella/article/details/7008168Rank Description:
This ranking is for the statistics of n-th results
The ranking of the daytime products for c written embedded software
Nineth Place: Coding Specification Class
Inconsistent naming of variables
Operators and expressions are difficult to understand
Excessive use of
C # Coding specifications summarized by myself-6. format,
Format
The unified use of the format can make the code clear, beautiful, and easy to read. In order not to affect the encoding efficiency, only the following provisions are made:
Length
The code of a method should not exceed 50 lines. If the Code exceeds 50 lines, consider encapsulating the logic in it into a function.
Space, empty line
The
It took years of visual Studio to discover this coding technique today, and it's a shame to share it.
Development environment: Vs2010+c#
1, code refactoring new class
If you're still like me. Use the right-click shortcut menu to create a new class, which is too out. VS, the "New Item dialog" comes out very slowly and affects your mood.When you find that you need to define a class, the correct approach is:
(assuming that the normal method is used).R804: Standard reservoir should not be used, except Std::arrayCause: Unpredictable (assumed to be implemented in a normal way).7. Key System PrinciplesR900: Increment and decrement operations cannot be used as sub-expressions.Example:int x=v[++i]; Violate++i;int x=v[i]; That's rightCause: It may be missed out.R901: Code should not rely on precedence rules under algorithm expression precedence.Example:X=a*b+c
Simple coding, publishing, and deployment of Web Service (C # instance), webservice
Recently, the boss is preparing to make the communication part of the existing C/S architecture project universal. He needs to support WebService to pave the way for the future B/S architecture upgrade, for this reason, I went to a variety of Baidu WebService tools, and gradually
marked on the MAC software are considered not to be retained by the class.When an instance variable points to corefoundation, C + +, or other non-objective-c objects, you need to use __strong and __ Regardless of whether the pointer is retained. The weak type modifier is explicitly specified. Corefoundation and other non-OBJECTIVE-C object pointers require expl
:
Enum {A = 10, B = 15, c = 20}; int arr1 [C] [B]; int (* arr2) [a]; arr2 = arr1; // does not match! = B
Solution:
Enum {A = 10, B = 10, c = 20}; int arr1 [C] [B]; int (* arr2) [a]; arr2 = arr1; // match a = BDo not add or subtract an integer to a pointer pointing to a non-array object.
Code:
struct numbers { short
C # Coding specifications summarized by myself-5. How to Write comments,
This article is a practical method for writing comments after reading several books mentioned in the preface and combining their own ideas:
How to write comments
Avoid using ambiguous pronouns
In some cases, pronouns such as "it" and "this" are prone to ambiguity. The safest way is not to replace all Pronouns that may be ambiguous
.
function comments, function functions, parameters, return values, error codes, written on top of the function, do not leave blank lines.
A comment for the statement group.
Single-line annotation on the right.
A complex structure, a macro-defined comment.
3 identifier naming
Name to be clear, with complete words or abbreviations.
Variable functions and types are named with all lowercase underlines. Constants are named with all caps and underscores.
Global v
权;DWORD dwFlags; // 保留;WCHAR szExeFile[MAX_PATH]; // 进程全名;} PROCESSENTRY32;
Process32Nextto get the next process informationParameters withProcess32First.Pure C Language Implementation code:CPlain Text view copy code ?
010203040506070809101112131415161718192021
#include #include #include int main(){PROCESSENTRY32 processEntry = { 0 };processEntry.dwSize = sizeof(PROCESSENTRY32);HANDLE hProcessSn
string:Instance Ddeconstructor was called. Free allocatedstring: Instance Ddeconstructor was called.============ Constructor with string:Instance Efree Allocatedstring: Instance Edeconstructor was called.However, considering that reference folding in rvalue references (reference collapsing) introduces some complexity (conversion rules for left and right values), resulting in an understanding problem, the application scope of the Rvalue reference is defined as the opening point.In practice, an
Canscrollhorizontally was better than Scrollablex (an obscure reference to the x-axis).X does not use underscores, hyphens, or any other nonalphanumeric characters.X do not use Hungarian notation.X AVOID using identifiers that conflict with keywords of widely used programming languages.Using Abbreviations and acronymsX does not use the abbreviations or contractions as part of identifier names.For example, use GetWindow rather than Getwin.X do not use any acronyms that is not widely accepted, an
Project in C ++ coding practice
In the practice of C ++ programming, there are usually some defects that affect program performance, efficiency, and localization. Some of these defects are listed below for your reference, and give some suggestions on the defect correction, and give priority to the defect search based on the extent of the impact caused by the def
inference:Delegate void somedelegate (); Public void = SomeMethod;17. Use tab to indent.18. All member variables must be declared at the top, separated by one line from the property or method.19. When defining a local variable, try to make it close to the place where it was used for the first time.20, the file name can reflect the class it uses.21. When using the opening brace ({), wrap the line.22, if the following even if there is only one line of code, also add {} surrounded:23. Create a d
,Constmcontainer);}; TemplateclassT>classmy_array{/*...*/}; McontainerDouble, my_arrayDouble> > mc;(2) A class can contain a member that is itself a template:templateclass s>class complex{ S Re, im; Templateclass t> Complex (const complexC): Re (C.real ( )), Im (C.imag ()) {} //... };complexfloat> F (0.0); complexdouble// can: There are conversions of float to doubleHowever, the template constructor is not used to generate the copy constructor and assignment operators, so y
for multiple platforms. For example, with GCC, you can build 32-bit x86 applications and 64-bit AMD64 applications on a 64-bit AMD64 platform, and you only need to bring "-m32" in the compiler when generating 32-bit programs.23. On UNIX systems, the ILP32 (int, long, pointer pointer) data model is no longer applicable to 64-bit applications. If you had already assumed that all int, long, and pointer lengths were 32 bits before you wrote the program, you now have to go back and rewrite it, becau
menu as a reusable subsystemExperiment Report Experiment CodeExperience: The difficulty of this experiment lies in the understanding and use of liunx system function getoptLesson Eight: Design ideas behind the codeExperience: Learn from different quality perspectives, such as product perspective, user's perspective, and so on, the menu open source want someone to use it. This paper summarizes the design methodology and several important design guidelines, such as modularization, interface desig
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.