Skip navigation.

So Easy[@]Opera

原来如此简单

Posts tagged with "c++"

Microsoft Foundation Classes (MFC)

, ,

Microsoft Foundation Classes, or MFC, is a Microsoft library that wraps portions of the Windows API in C++ classes, forming an application framework. Classes are defined for many of the handle-managed Windows objects and also for predefined windows and common controls. [via Wiki]


"#ifdef"在C++中运用

, ,

常常在建立header file的时候需要先写一段文字
比如下面这段话

#ifdef HEADERFILENAME_H
#define HEADERFILENAME_H


class ClassName
{
  ...
};

#endif

那段#ifdef有必要写吗?
其实有些无写都不会影响代码的Runtime
不过对运行速度和文件大小有一定的影响

大概很多人很喜欢用#include来抓取文件吧
炎也很喜欢
总是在main.cpp中include一次
然后又在classfile.cpp中又使用一次
每次都include同样的Headerfile.h
这样就导致了Compiler运作的时候在link的时候会重复同样的headerfile内容
相同重复的内容出现就有可能导致不良的情况的发生
即时没有compilerError或者RunrimeError
也会让程序运行缓慢,想想看吧,在重复compiler一段Code之后产生的程序大小

这里还有更多相关的内容((#if, #ifdef, #ifndef, #else, #elif, #endif, and defined)
July 2009
S M T W T F S
June 2009August 2009
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31