background preloader

Just C/C++ Coding

Facebook Twitter

Operators in C and C++ When not overloaded, for the operators &&, ||, and , (the comma operator), there is a sequence point after the evaluation of the first operand.

Operators in C and C++

C++ also contains the type conversion operators const_cast, static_cast, dynamic_cast, and reinterpret_cast. The formatting of these operators means that their precedence level is unimportant. Table[edit] For the purposes of this table, a, b, and c represent valid values (literals, values from variables, or return value), object names, or lvalues, as appropriate. R, S and T stand for any type(s), and K for a class type or enumerated type. "Can overload" means that the operator can be overloaded in C++. Arithmetic operators[edit] Comparison operators/relational operators[edit] Logical operators[edit] Bitwise operators[edit] Compound assignment operators[edit] Member and pointer operators[edit] Other operators[edit] Notes: Operator precedence[edit] A precedence table, while mostly adequate, cannot resolve a few details.

Notes[edit] Precedence and bindings. 透过汇编另眼看世界之DLL导出函数调用 - 开发者在线 - www.builder.com.cn. 前言:我一直对DLL技术充满好奇,一方面是因为我对DLL的导入/导出机制还不是特别的了解,另一面是因为我发现:DLL技术在Windows平台下占有重要的地位,几乎所有的Win32 API都是以导出函数的形式存放于不同的DLL文件中,在DLL方面的学习是任何一个想深入研究Windows内部机制的Windows程序员都不可能回避的事实。

透过汇编另眼看世界之DLL导出函数调用 - 开发者在线 - www.builder.com.cn

我在查阅了大量的文章后,对DLL技术有了一定的了解,所以我写了这篇文章来总结和整理我的思路,也为以后深入的学习提供宝贵的资料。 对于如何制作DLL,网上有很多资料,我这里就不多罗嗦了。 现在假设我们已经成功生成了一个Win32 DLL,这个DLL的名字是DllInDepth.dll,它只导出了一个简单的C++函数: __declspec(dllexport) void foobar(int iValue) { printf("The value is %d. " 从 DLL 导出. Type Casting. Implicit conversion Implicit conversions are automatically performed when a value is copied to a compatible type.

Type Casting

For example: Here, the value of a is promoted from short to int without the need of any explicit operator. This is known as a standard conversion. Standard conversions affect fundamental data types, and allow the conversions between numerical types (short to int, int to float, double to int...), to or from bool, and some pointer conversions. Converting to int from some smaller integer type, or to double from float is known as promotion, and is guaranteed to produce the exact same value in the destination type. For non-fundamental types, arrays and functions implicitly convert to pointers, and pointers in general allow the following conversions: Implicit conversions with classes The type-cast operator uses a particular syntax: it uses the operator keyword followed by the destination type and an empty set of parentheses. Keyword explicit This may or may not be what was intended. C++ and the linker. Copton.net 2.4263102175e-12 C++ and the linker Main.

C++ and the linker

C and C++ Style Guides. This is an archive of style guides for C and C++ code.

C and C++ Style Guides

Also archived here are some documents that discuss the value and utility of style guides. The documents are not listed in any particular order. For history buffs, this collection includes two style guides that are based on work done at Bell Labs Indian Hill (the site in Naperville, Illinois where the 5ESS digital switch is developed). The list includes original versions whenever possible. If you have a working formatter (either LaTeX or troff), the original versions are almost certainly the best. Original Indian Hill guide with annotations by H. Finally, if you would like a quick way to develop your own style guide for C, C++, or Java, Sven Rosvall offers a style-document generator. Home page. Coding Style Conventions. Coding style conventions are used in this sample series to aid clarity and consistency.

Coding Style Conventions

The "Hungarian" notation conventions are used. These have become a common coding practice in Win32 programming. They include variable prefix notations that give to variable names a suggestion of the type of the variable. The following table lists common prefixes. These are often combined, as in the following. Google C++ Style Guide.

Definition: Streams are a replacement for printf() and scanf().

Google C++ Style Guide

Pros: With streams, you do not need to know the type of the object you are printing. You do not have problems with format strings not matching the argument list. (Though with gcc, you do not have that problem with printf either.) Streams have automatic constructors and destructors that open and close the relevant files. Cons: Streams make it difficult to do functionality like pread(). Decision: Do not use streams, except where required by a logging interface. There are various pros and cons to using streams, but in this case, as in many other cases, consistency trumps the debate. Extended Discussion There has been debate on this issue, so this explains the reasoning in greater depth. Proponents of streams have argued that streams are the obvious choice of the two, but the issue is not actually so clear. Cout << this; // Prints the address cout << *this; // Prints the contents.