이수안 데이터 연구실

검색 :
RSS 구독 : 글 / 댓글 / 트랙백 / 글+트랙백

C++ Preprocessor: Always Assert Your Code Is Right

Site : http://www.devarticles.com/c/a/cplusplu ··· right%2F

Are you looking for a way to speed up the debugging process in C++? This article explains how to use asserts to do just that, showing that not all macros are evil.

If a man begins with certainties, he shall end in doubts;

But if he will be content to begin with doubts,

 He shall end in certainties.

[Francis Bacon 1561-1626]

Assertive Programming

If there is one thing I have learned over the past few years, it is not to underestimate the power of assert(). It comes with your compiler and can be found either in cassert or assert.h.

The reason I love assert is because it looks after me and helps me find bugs I was sure weren

이올린에 북마크하기(0) 이올린에 추천하기(0)
2008/04/26 18:20 2008/04/26 18:20

맨 위로

C++ Preprocessor: The Code in the Middle

Site : http://www.devarticles.com/c/a/cplusplu ··· iddle%2F

In this article, we examine instructions given to the preprocessor and see how they are used in general. The preprocessor handles your code before the compiler interprets it. If you have been wondering just what the preprocessor is used for, this article explains.

Whence and what art thou, execrable shape?

[John Milton 1608-1674]

The Preprocessor and the Compiler

Before the compiler interprets your code, the preprocessor handles it. Its task is to scan through your code and to look for preprocessor instructions; these can for example be used to replace certain tokens with string or numerical values, or to blank out complete sections of the code before the compiler sees it. You can recognize these instructions from the pound (#) symbol that needs to precede every preprocessor instruction.

We are going to examine these instructions and see how they are used in general. Most probably you have been using at least one of them without giving it much thought:

이올린에 북마크하기(0) 이올린에 추천하기(0)
2008/04/26 17:57 2008/04/26 17:57

맨 위로

C++ Preprocessor: Always Assert Your Code Is Right

이올린에 북마크하기(0) 이올린에 추천하기(0)
2007/07/30 10:34 2007/07/30 10:34

맨 위로

C++ Preprocessor: The Code in the Middle

이올린에 북마크하기(0) 이올린에 추천하기(0)
2007/07/30 10:33 2007/07/30 10:33

맨 위로