5.24 Declaring Attributes of Functions【转】
转自:https://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/Function-Attributes.html
5.24 Declaring Attributes of Functions
In GNU C, you declare certain things about functions called in your program which help the compiler optimize function calls and check your code more carefully.
The keyword __attribute__ allows you to specify special attributes when making a declaration. This keyword is followed by an attribute specification inside double parentheses. The following attributes are currently defined for functions on all targets: noreturn, noinline, always_inline, pure, const, nothrow, sentinel, format, format_arg, no_instrument_function, section, constructor, destructor,used, unused, deprecated, weak, malloc, alias, warn_unused_result and nonnull. Several other attributes are defined for functions on particular target systems. Other attributes, including section are supported for variables declarations (see Variable Attributes) and for types (see Type Attributes).
You may also specify attributes with `__' preceding and following each keyword. This allows you to use them in header files without being concerned about a possible macro of the same name. For example, you may use __noreturn__ instead of noreturn.
See Attribute Syntax, for details of the exact syntax for using attributes.
alias ("target")- The
aliasattribute causes the declaration to be emitted as an alias for another symbol, which must be specified. For instance,void __f () { /* Do something. */; }
void f () __attribute__ ((weak, alias ("__f")));declares `f' to be a weak alias for `__f'. In C++, the mangled name for the target must be used. It is an error if `__f' is not defined in the same translation unit.
Not all target machines support this attribute.
always_inline- Generally, functions are not inlined unless optimization is specified. For functions declared inline, this attribute inlines the function even if no optimization level was specified.
cdecl- On the Intel 386, the
cdeclattribute causes the compiler to assume that the calling function will pop off the stack space used to pass arguments. This is useful to override the effects of the-mrtd switch. const- Many functions do not examine any values except their arguments, and have no effects except the return value. Basically this is just slightly more strict class than the
pureattribute below, since function is not allowed to read global memory.Note that a function that has pointer arguments and examines the data pointed to must not be declared
const. Likewise, a function that calls a non-constfunction usually must not beconst. It does not make sense for aconstfunction to returnvoid.The attribute
constis not implemented in GCC versions earlier than 2.5. An alternative way to declare that a function has no side effects, which works in the current version and in some older versions, is as follows:typedef int intfn (); extern const intfn square;This approach does not work in GNU C++ from 2.6.0 on, since the language specifies that the `const' must be attached to the return value.
constructordestructor- The
constructorattribute causes the function to be called automatically before execution entersmain (). Similarly, thedestructorattribute causes the function to be called automatically aftermain ()has completed orexit ()has been called. Functions with these attributes are useful for initializing data that will be used implicitly during the execution of the program.These attributes are not currently implemented for Objective-C.
deprecated- The
deprecatedattribute results in a warning if the function is used anywhere in the source file. This is useful when identifying functions that are expected to be removed in a future version of a program. The warning also includes the location of the declaration of the deprecated function, to enable users to easily find further information about why the function is deprecated, or what they should do instead. Note that the warnings only occurs for uses:int old_fn () __attribute__ ((deprecated));
int old_fn ();
int (*fn_ptr)() = old_fn;results in a warning on line 3 but not line 2.
The
deprecatedattribute can also be used for variables and types (see Variable Attributes, see Type Attributes.) dllexport- On Microsoft Windows targets and Symbian OS targets the
dllexportattribute causes the compiler to provide a global pointer to a pointer in a DLL, so that it can be referenced with thedllimportattribute. On Microsoft Windows targets, the pointer name is formed by combining_imp__and the function or variable name.You can use
__declspec(dllexport)as a synonym for__attribute__ ((dllexport))for compatibility with other compilers.On systems that support the
visibilityattribute, this attribute also implies “default” visibility, unless avisibilityattribute is explicitly specified. You should avoid the use ofdllexportwith “hidden” or “internal” visibility; in the future GCC may issue an error for those cases.Currently, the
dllexportattribute is ignored for inlined functions, unless the -fkeep-inline-functions flag has been used. The attribute is also ignored for undefined symbols.When applied to C++ classes, the attribute marks defined non-inlined member functions and static data members as exports. Static consts initialized in-class are not marked unless they are also defined out-of-class.
For Microsoft Windows targets there are alternative methods for including the symbol in the DLL's export table such as using a .def file with an
EXPORTSsection or, with GNU ld, using the --export-all linker flag. dllimport- On Microsoft Windows and Symbian OS targets, the
dllimportattribute causes the compiler to reference a function or variable via a global pointer to a pointer that is set up by the DLL exporting the symbol. The attribute impliesexternstorage. On Microsoft Windows targets, the pointer name is formed by combining_imp__and the function or variable name.You can use
__declspec(dllimport)as a synonym for__attribute__ ((dllimport))for compatibility with other compilers.Currently, the attribute is ignored for inlined functions. If the attribute is applied to a symbol definition, an error is reported. If a symbol previously declared
dllimportis later defined, the attribute is ignored in subsequent references, and a warning is emitted. The attribute is also overridden by a subsequent declaration asdllexport.When applied to C++ classes, the attribute marks non-inlined member functions and static data members as imports. However, the attribute is ignored for virtual methods to allow creation of vtables using thunks.
On the SH Symbian OS target the
dllimportattribute also has another affect—it can cause the vtable and run-time type information for a class to be exported. This happens when the class has a dllimport'ed constructor or a non-inline, non-pure virtual function and, for either of those two conditions, the class also has a inline constructor or destructor and has a key function that is defined in the current translation unit.For Microsoft Windows based targets the use of the
dllimportattribute on functions is not necessary, but provides a small performance benefit by eliminating a thunk in the DLL. The use of thedllimportattribute on imported variables was required on older versions of the GNU linker, but can now be avoided by passing the --enable-auto-import switch to the GNU linker. As with functions, using the attribute for a variable eliminates a thunk in the DLL.One drawback to using this attribute is that a pointer to a function or variable marked as
dllimportcannot be used as a constant address. On Microsoft Windows targets, the attribute can be disabled for functions by setting the -mnop-fun-dllimport flag. eightbit_data- Use this attribute on the H8/300, H8/300H, and H8S to indicate that the specified variable should be placed into the eight bit data section. The compiler will generate more efficient code for certain operations on data in the eight bit data area. Note the eight bit data area is limited to 256 bytes of data.
You must use GAS and GLD from GNU binutils version 2.7 or later for this attribute to work correctly.
far- On 68HC11 and 68HC12 the
farattribute causes the compiler to use a calling convention that takes care of switching memory banks when entering and leaving a function. This calling convention is also the default when using the -mlong-calls option.On 68HC12 the compiler will use the
callandrtcinstructions to call and return from a function.On 68HC11 the compiler will generate a sequence of instructions to invoke a board-specific routine to switch the memory bank and call the real function. The board-specific routine simulates a
call. At the end of a function, it will jump to a board-specific routine instead of usingrts. The board-specific return routine simulates thertc. fastcall- On the Intel 386, the
fastcallattribute causes the compiler to pass the first two arguments in the registers ECX and EDX. Subsequent arguments are passed on the stack. The called function will pop the arguments off the stack. If the number of arguments is variable all arguments are pushed on the stack. format (archetype,string-index,first-to-check)- The
formatattribute specifies that a function takesprintf,scanf,strftimeorstrfmonstyle arguments which should be type-checked against a format string. For example, the declaration:extern int
my_printf (void *my_object, const char *my_format, ...)
__attribute__ ((format (printf, 2, 3)));causes the compiler to check the arguments in calls to
my_printffor consistency with theprintfstyle format string argumentmy_format.The parameter archetype determines how the format string is interpreted, and should be
printf,scanf,strftimeorstrfmon. (You can also use__printf__,__scanf__,__strftime__or__strfmon__.) The parameter string-index specifies which argument is the format string argument (starting from 1), while first-to-check is the number of the first argument to check against the format string. For functions where the arguments are not available to be checked (such asvprintf), specify the third parameter as zero. In this case the compiler only checks the format string for consistency. Forstrftimeformats, the third parameter is required to be zero. Since non-static C++ methods have an implicitthisargument, the arguments of such methods should be counted from two, not one, when giving values for string-index and first-to-check.In the example above, the format string (
my_format) is the second argument of the functionmy_print, and the arguments to check start with the third argument, so the correct parameters for the format attribute are 2 and 3.The
formatattribute allows you to identify your own functions which take format strings as arguments, so that GCC can check the calls to these functions for errors. The compiler always (unless -ffreestanding or -fno-builtin is used) checks formats for the standard library functionsprintf,fprintf,sprintf,scanf,fscanf,sscanf,strftime,vprintf,vfprintfandvsprintfwhenever such warnings are requested (using -Wformat), so there is no need to modify the header file stdio.h. In C99 mode, the functionssnprintf,vsnprintf,vscanf,vfscanfandvsscanfare also checked. Except in strictly conforming C standard modes, the X/Open functionstrfmonis also checked as areprintf_unlockedandfprintf_unlocked. See Options Controlling C Dialect.The target may provide additional types of format checks. See Format Checks Specific to Particular Target Machines.
format_arg (string-index)- The
format_argattribute specifies that a function takes a format string for aprintf,scanf,strftimeorstrfmonstyle function and modifies it (for example, to translate it into another language), so the result can be passed to aprintf,scanf,strftimeorstrfmonstyle function (with the remaining arguments to the format function the same as they would have been for the unmodified string). For example, the declaration:extern char *
my_dgettext (char *my_domain, const char *my_format)
__attribute__ ((format_arg (2)));causes the compiler to check the arguments in calls to a
printf,scanf,strftimeorstrfmontype function, whose format string argument is a call to themy_dgettextfunction, for consistency with the format string argumentmy_format. If theformat_argattribute had not been specified, all the compiler could tell in such calls to format functions would be that the format string argument is not constant; this would generate a warning when -Wformat-nonliteral is used, but the calls could not be checked without the attribute.The parameter string-index specifies which argument is the format string argument (starting from one). Since non-static C++ methods have an implicit
thisargument, the arguments of such methods should be counted from two.The
format-argattribute allows you to identify your own functions which modify format strings, so that GCC can check the calls toprintf,scanf,strftimeorstrfmontype function whose operands are a call to one of your own function. The compiler always treatsgettext,dgettext, anddcgettextin this manner except when strict ISO C support is requested by -ansi or an appropriate -stdoption, or -ffreestanding or -fno-builtin is used. See Options Controlling C Dialect. function_vector- Use this attribute on the H8/300, H8/300H, and H8S to indicate that the specified function should be called through the function vector. Calling a function through the function vector will reduce code size, however; the function vector has a limited size (maximum 128 entries on the H8/300 and 64 entries on the H8/300H and H8S) and shares space with the interrupt vector.
You must use GAS and GLD from GNU binutils version 2.7 or later for this attribute to work correctly.
interrupt- Use this attribute on the ARM, AVR, C4x, M32R/D and Xstormy16 ports to indicate that the specified function is an interrupt handler. The compiler will generate function entry and exit sequences suitable for use in an interrupt handler when this attribute is present.
Note, interrupt handlers for the m68k, H8/300, H8/300H, H8S, and SH processors can be specified via the
interrupt_handlerattribute.Note, on the AVR, interrupts will be enabled inside the function.
Note, for the ARM, you can specify the kind of interrupt to be handled by adding an optional parameter to the interrupt attribute like this:
void f () __attribute__ ((interrupt ("IRQ")));Permissible values for this parameter are: IRQ, FIQ, SWI, ABORT and UNDEF.
interrupt_handler- Use this attribute on the m68k, H8/300, H8/300H, H8S, and SH to indicate that the specified function is an interrupt handler. The compiler will generate function entry and exit sequences suitable for use in an interrupt handler when this attribute is present.
long_call/short_call- This attribute specifies how a particular function is called on ARM. Both attributes override the -mlong-calls (see ARM Options) command line switch and
#pragma long_callssettings. Thelong_callattribute causes the compiler to always call the function by first loading its address into a register and then using the contents of that register. Theshort_callattribute always places the offset to the function from the call site into the `BL' instruction directly. longcall/shortcall- On the RS/6000 and PowerPC, the
longcallattribute causes the compiler to always call this function via a pointer, just as it would if the -mlongcall option had been specified. Theshortcallattribute causes the compiler not to do this. These attributes override both the -mlongcall switch and the#pragma longcallsetting.See RS/6000 and PowerPC Options, for more information on whether long calls are necessary.
malloc- The
mallocattribute is used to tell the compiler that a function may be treated as if any non-NULLpointer it returns cannot alias any other pointer valid when the function returns. This will often improve optimization. Standard functions with this property includemallocandcalloc.realloc-like functions have this property as long as the old pointer is never referred to (including comparing it to the new pointer) after the function returns a non-NULLvalue. model (model-name)- On the M32R/D, use this attribute to set the addressability of an object, and of the code generated for a function. The identifier model-name is one of
small,medium, orlarge, representing each of the code models.Small model objects live in the lower 16MB of memory (so that their addresses can be loaded with the
ld24instruction), and are callable with theblinstruction.Medium model objects may live anywhere in the 32-bit address space (the compiler will generate
seth/add3instructions to load their addresses), and are callable with theblinstruction.Large model objects may live anywhere in the 32-bit address space (the compiler will generate
seth/add3instructions to load their addresses), and may not be reachable with theblinstruction (the compiler will generate the much slowerseth/add3/jlinstruction sequence).On IA-64, use this attribute to set the addressability of an object. At present, the only supported identifier for model-name is
small, indicating addressability via “small” (22-bit) addresses (so that their addresses can be loaded with theaddlinstruction). Caveat: such addressing is by definition not position independent and hence this attribute must not be used for objects defined by shared libraries. naked- Use this attribute on the ARM, AVR, C4x and IP2K ports to indicate that the specified function does not need prologue/epilogue sequences generated by the compiler. It is up to the programmer to provide these sequences.
near- On 68HC11 and 68HC12 the
nearattribute causes the compiler to use the normal calling convention based onjsrandrts. This attribute can be used to cancel the effect of the -mlong-calls option. no_instrument_function- If -finstrument-functions is given, profiling function calls will be generated at entry and exit of most user-compiled functions. Functions with this attribute will not be so instrumented.
noinline- This function attribute prevents a function from being considered for inlining.
nonnull (arg-index, ...)- The
nonnullattribute specifies that some function parameters should be non-null pointers. For instance, the declaration:extern void *
my_memcpy (void *dest, const void *src, size_t len)
__attribute__((nonnull (1, 2)));causes the compiler to check that, in calls to
my_memcpy, arguments dest and src are non-null. If the compiler determines that a null pointer is passed in an argument slot marked as non-null, and the -Wnonnull option is enabled, a warning is issued. The compiler may also choose to make optimizations based on the knowledge that certain function arguments will not be null.If no argument index list is given to the
nonnullattribute, all pointer arguments are marked as non-null. To illustrate, the following declaration is equivalent to the previous example:extern void *
my_memcpy (void *dest, const void *src, size_t len)
__attribute__((nonnull)); noreturn- A few standard library functions, such as
abortandexit, cannot return. GCC knows this automatically. Some programs define their own functions that never return. You can declare themnoreturnto tell the compiler this fact. For example,void fatal () __attribute__ ((noreturn)); void
fatal (/* ... */)
{
/* ... */ /* Print error message. */ /* ... */
exit (1);
}The
noreturnkeyword tells the compiler to assume thatfatalcannot return. It can then optimize without regard to what would happen iffatalever did return. This makes slightly better code. More importantly, it helps avoid spurious warnings of uninitialized variables.The
noreturnkeyword does not affect the exceptional path when that applies: anoreturn-marked function may still return to the caller by throwing an exception or callinglongjmp.Do not assume that registers saved by the calling function are restored before calling the
noreturnfunction.It does not make sense for a
noreturnfunction to have a return type other thanvoid.The attribute
noreturnis not implemented in GCC versions earlier than 2.5. An alternative way to declare that a function does not return, which works in the current version and in some older versions, is as follows:typedef void voidfn (); volatile voidfn fatal;This approach does not work in GNU C++.
nothrow- The
nothrowattribute is used to inform the compiler that a function cannot throw an exception. For example, most functions in the standard C library can be guaranteed not to throw an exception with the notable exceptions ofqsortandbsearchthat take function pointer arguments. Thenothrowattribute is not implemented in GCC versions earlier than 3.3. pure- Many functions have no effects except the return value and their return value depends only on the parameters and/or global variables. Such a function can be subject to common subexpression elimination and loop optimization just as an arithmetic operator would be. These functions should be declared with the attribute
pure. For example,int square (int) __attribute__ ((pure));says that the hypothetical function
squareis safe to call fewer times than the program says.Some of common examples of pure functions are
strlenormemcmp. Interesting non-pure functions are functions with infinite loops or those depending on volatile memory or other system resource, that may change between two consecutive calls (such asfeofin a multithreading environment).The attribute
pureis not implemented in GCC versions earlier than 2.96. regparm (number)- On the Intel 386, the
regparmattribute causes the compiler to pass up to number integer arguments in registers EAX, EDX, and ECX instead of on the stack. Functions that take a variable number of arguments will continue to be passed all of their arguments on the stack.Beware that on some ELF systems this attribute is unsuitable for global functions in shared libraries with lazy binding (which is the default). Lazy binding will send the first call via resolving code in the loader, which might assume EAX, EDX and ECX can be clobbered, as per the standard calling conventions. Solaris 8 is affected by this. GNU systems with GLIBC 2.1 or higher, and FreeBSD, are believed to be safe since the loaders there save all registers. (Lazy binding can be disabled with the linker or the loader if desired, to avoid the problem.)
saveall- Use this attribute on the H8/300, H8/300H, and H8S to indicate that all registers except the stack pointer should be saved in the prologue regardless of whether they are used or not.
section ("section-name")- Normally, the compiler places the code it generates in the
textsection. Sometimes, however, you need additional sections, or you need certain particular functions to appear in special sections. Thesectionattribute specifies that a function lives in a particular section. For example, the declaration:extern void foobar (void) __attribute__ ((section ("bar")));puts the function
foobarin thebarsection.Some file formats do not support arbitrary sections so the
sectionattribute is not available on all platforms. If you need to map the entire contents of a module to a particular section, consider using the facilities of the linker instead. sentinel- This function attribute ensures that a parameter in a function call is an explicit
NULL. The attribute is only valid on variadic functions. By default, the sentinel is located at position zero, the last parameter of the function call. If an optional integer position argument P is supplied to the attribute, the sentinel must be located at position P counting backwards from the end of the argument list.__attribute__ ((sentinel))
is equivalent to
__attribute__ ((sentinel(0)))The attribute is automatically set with a position of 0 for the built-in functions
execlandexeclp. The built-in functionexeclehas the attribute set with a position of 1.A valid
NULLin this context is defined as zero with any pointer type. If your system defines theNULLmacro with an integer type then you need to add an explicit cast. GCC replacesstddef.hwith a copy that redefines NULL appropriately.The warnings for missing or incorrect sentinels are enabled with -Wformat.
short_call- See long_call/short_call.
shortcall- See longcall/shortcall.
signal- Use this attribute on the AVR to indicate that the specified function is a signal handler. The compiler will generate function entry and exit sequences suitable for use in a signal handler when this attribute is present. Interrupts will be disabled inside the function.
sp_switch- Use this attribute on the SH to indicate an
interrupt_handlerfunction should switch to an alternate stack. It expects a string argument that names a global variable holding the address of the alternate stack.void *alt_stack;
void f () __attribute__ ((interrupt_handler,
sp_switch ("alt_stack"))); stdcall- On the Intel 386, the
stdcallattribute causes the compiler to assume that the called function will pop off the stack space used to pass arguments, unless it takes a variable number of arguments. tiny_data- Use this attribute on the H8/300H and H8S to indicate that the specified variable should be placed into the tiny data section. The compiler will generate more efficient code for loads and stores on data in the tiny data section. Note the tiny data area is limited to slightly under 32kbytes of data.
trap_exit- Use this attribute on the SH for an
interrupt_handlerto return usingtrapainstead ofrte. This attribute expects an integer argument specifying the trap number to be used. unused- This attribute, attached to a function, means that the function is meant to be possibly unused. GCC will not produce a warning for this function.
used- This attribute, attached to a function, means that code must be emitted for the function even if it appears that the function is not referenced. This is useful, for example, when the function is referenced only in inline assembly.
visibility ("visibility_type")- The
visibilityattribute on ELF targets causes the declaration to be emitted with default, hidden, protected or internal visibility.void __attribute__ ((visibility ("protected")))
f () { /* Do something. */; }
int i __attribute__ ((visibility ("hidden")));See the ELF gABI for complete details, but the short story is:
- default
- Default visibility is the normal case for ELF. This value is available for the visibility attribute to override other options that may change the assumed visibility of symbols.
- hidden
- Hidden visibility indicates that the symbol will not be placed into the dynamic symbol table, so no other module (executable or shared library) can reference it directly.
- internal
- Internal visibility is like hidden visibility, but with additional processor specific semantics. Unless otherwise specified by the psABI, GCC defines internal visibility to mean that the function is never called from another module. Note that hidden symbols, while they cannot be referenced directly by other modules, can be referenced indirectly via function pointers. By indicating that a symbol cannot be called from outside the module, GCC may for instance omit the load of a PIC register since it is known that the calling function loaded the correct value.
- protected
- Protected visibility indicates that the symbol will be placed in the dynamic symbol table, but that references within the defining module will bind to the local symbol. That is, the symbol cannot be overridden by another module.
Not all ELF targets support this attribute.
warn_unused_result- The
warn_unused_resultattribute causes a warning to be emitted if a caller of the function with this attribute does not use its return value. This is useful for functions where not checking the result is either a security problem or always a bug, such asrealloc.int fn () __attribute__ ((warn_unused_result));
int foo ()
{
if (fn () < 0) return -1;
fn ();
return 0;
}results in warning on line 5.
weak- The
weakattribute causes the declaration to be emitted as a weak symbol rather than a global. This is primarily useful in defining library functions which can be overridden in user code, though it can also be used with non-function declarations. Weak symbols are supported for ELF targets, and also for a.out targets when using the GNU assembler and linker.
You can specify multiple attributes in a declaration by separating them by commas within the double parentheses or by immediately following an attribute declaration with another attribute declaration.
Some people object to the __attribute__ feature, suggesting that ISO C's #pragma should be used instead. At the time __attribute__ was designed, there were two reasons for not doing this.
- It is impossible to generate
#pragmacommands from a macro. - There is no telling what the same
#pragmamight mean in another compiler.
These two reasons applied to almost any application that might have been proposed for #pragma. It was basically a mistake to use #pragma for anything.
The ISO C99 standard includes _Pragma, which now allows pragmas to be generated from macros. In addition, a #pragma GCC namespace is now in use for GCC-specific pragmas. However, it has been found convenient to use __attribute__ to achieve a natural attachment of attributes to their corresponding declarations, whereas #pragma GCC is of use for constructs that do not naturally form part of the grammar. See Miscellaneous Preprocessing Directives.
5.24 Declaring Attributes of Functions【转】的更多相关文章
- 2-4. Using auto with Functions
在C++14中允许使用type deduction用于函数参数和函数返回值 Return Type Deduction in C++11 #include <iostream> using ...
- iOS.ObjC.__attribute__-directives
__attribute__ Directives Reference 1. __attribute__ directives in Objective-C (AAAA+) (Read Again) h ...
- DTD - Attributes
In a DTD, attributes are declared with an ATTLIST declaration. Declaring Attributes An attribute dec ...
- How to create functions that can accept variable number of parameters such as Format
http://www.chami.com/tips/delphi/112696D.html Sometimes it's necessary to pass undefined number of [ ...
- 5. First-Class Functions
Function in python are first-class objects (runtime / element / argument / return) 1. Treating a Fun ...
- Pintos-斯坦福大学操作系统Project详解-Project1
转载请注明出处. 前言: 本实验来自斯坦福大学cs140课程,只限于教学用途,以下是他们对于Pintos系统的介绍: Pintos is a simple operating system fra ...
- Alignment And Compiler Error C2719 字节对齐和编译错误C2719
Compiler Error C2719 'parameter': formal parameter with __declspec(align('#')) won't be aligned The ...
- C++ Under the Hood
The original article is taken from http://msdn.microsoft.com/archive/en-us/dnarvc/html/jangrayhood.a ...
- Sphinx 2.2.11-release reference manual
1. Introduction 1.1. About 1.2. Sphinx features 1.3. Where to get Sphinx 1.4. License 1.5. Credits 1 ...
随机推荐
- Android 多线程处理之多线程用法
handler.post(r)其实这样并不会新起线程,只是执行的runnable里的run()方法,却没有执行start()方法,所以runnable走的还是UI线程. 1.如果像这样,是可以操作ui ...
- Android 使用FACE++架构包实现人脸识别
今天给大家带来一个通过使用Face++来实现人脸识别的功能. 我们先去这个Face++官网看看:http://www.faceplusplus.com.cn 我们点开案例可以看到众多我们熟知的软件都是 ...
- python set add 导致问题 TypeError: unhashable type: 'list'
问题复现 >>> a = set() >>> b = set() >>> b.add(1) >>> a.add(b) Trace ...
- WordPress 性能检测与速度优化
来源:SayBlog.Me [摘要]在如何提升WordPress性能与速度方面多花一些时间是值得的,本文下面为大家就如何提升WordPress运行效率列出了几点建议以供参考. 你的WordPress博 ...
- oracle 时间格式修改
1.临时修改时间格式第一种方式 :select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;第二种方式:alter session set n ...
- new操作符做了什么??
在javascript中,new操作符随处可见,我讲一下我自己对new操作符的理解... 构造函数无返回值 //测试代码 function Foo(name) { var age = 20; this ...
- 笔记:ASP.NET MVC安全
XSRF/CSRF Prevention in MVC ValidateAntiForgeryToken 参考这里的简单例子:http://www.asp.net/mvc/tutorials/mvc- ...
- MVC4之ModelBinder-模型绑定
最近悟出来一个道理,在这儿分享给大家:学历代表你的过去,能力代表你的现在,学习代表你的将来. 十年河东十年河西,莫欺少年穷 学无止境,精益求精 最近在做自学MVC,遇到的问题很多,索性一点点总结 ...
- Jquery点击表格单位时选中其中的Radio的三个方法
HTML: <table> <tr> <td> 1<br> <input type="radio" name="ch ...
- git打tag 三步骤
git status git tag publish/1.0.0 git push origin publish/1.0.0