The C Preprocessor

Last revised July 2000

for GCC version 2

Richard M. Stallman


The C Preprocessor

The C preprocessor is a macro processor that is used automatically by the C compiler to transform your program before actual compilation. It is called a macro processor because it allows you to define macros, which are brief abbreviations for longer constructs.

C Àü󸮱â´Â ½ÇÁ¦·Î ÄÄÆÄÀÏ Çϱâ Àü¿¡ ´ç½ÅÀÇ ÇÁ·Î±×·¥ÀÌ ÀÚµ¿ÀûÀ¸·Î C ÄÄÆÄÀÏ·¯¿¡ ÀÇÇØ º¯ÇüµÇ´Â ¸ÅÅ©·Î ÇÁ·Î¼¼¼­ ÀÌ´Ù. ¸ÅÅ©·Î ÇÁ·Î¼¼¼­¶ó°íµµ ºÒ¸®´Â ÀÌÀ¯´Â ´õ ±ä ±¸Á¶¿¡ ´ëÇØ °£·«ÇÑ Ãà¾à¾îÀÎ ¸ÅÅ©·ÎµéÀ» Á¤ÀÇ ÇÏ´Â °ÍÀ» Çã¶ôÇϱ⠶§¹®ÀÌ´Ù.

The C preprocessor is intended only for macro processing of C, C++ and Objective C source files. For macro processing of other files, you are strongly encouraged to use alternatives like M4, which will likely give you better results and avoid many problems. For example, normally the C preprocessor does not preserve arbitrary whitespace verbatim, but instead replaces each sequence with a single space.

C Àü󸮱â´Â  ¿ÀÁ÷C, C++ ±×¸®°í °´Ã¼ C ¼Ò½º ÆÄÀϵ鿡¼­ÀÇ ¸ÅÅ©·Î ÇÁ·Î¼¼½Ì¸¸À» À§ÇÑ °ÍÀÌ´Ù. ´Ù¸¥ ÆÄÀϵ鿡 ¸ÅÅ©·Î ÇÁ·Î¼¼½ÌÀ» À§ÇØ ´ç½ÅÀÌ ´õ ÁÁÀº °á°ú¿Í ¸¹Àº ¹®Á¦¸¦ ÇÇÇÒ ¼ö ÀÖµµ·ÏM4 ¸¦ ´ë¾ÈÀ¸·Î »ç¿ëÇϱ⸦ °­·ÂÇÏ°Ô ±ÇÀåÇÑ´Ù. ¿¹¸¦ µé¾î C Àü󸮱â´Â  ¸Ú´ë·Î °ø¹éÀ» º¸ÀüÇÏÁö ¾Ê°í ´ë½Å ÇϳªÀÇ °ø°£À¸·Î °¢ ¿­µéÀ» ±³Ã¼ÇÑ´Ù.

For use on C-like source files, the C preprocessor provides four separate facilities that you can use as you see fit:

C-like ¼Ò½º ÆÄÀϵ鿡 »ç¿ëÀ» À§ÇØ C Àü󸮱â´Â ´ç½ÅÀÌ ÀûÇÕÇÑ °ÍÀ» »ç¿ëÇÒ ¼ö ÀÖ´Â ³×°³ÀÇ ºÐ¸®µÈ ÆíÀÍÀ» Á¦°øÇÑ´Ù.:

C preprocessors vary in some details. This manual discusses the GNU C preprocessor, which provides a small superset of the features of ISO Standard C.

C Àü󸮱â´Â ¾à°£ ¼¼ºÎÀûÀ¸·Î ´Ù¾çÇÏ´Ù. ÀÌ ¸Å´º¾óÀº ISO Ç¥ÁØ CÀÇ Æ¯Â¡À» ÀÛÀº »óÀ§ ¼³Á¤À¸·Î Á¦°øÇÏ´Â GNU C Àü󸮱⸦ ³íÀÇ ÇÑ´Ù.

In its default mode, the GNU C preprocessor does not do a few things required by the standard. These are features which are rarely, if ever, used, and may cause surprising changes to the meaning of a program which does not expect them. To get strict ISO Standard C, you should use the `-std=c89' or `-std=c99' options, depending on which version of the standard you want. To get all the mandatory diagnostics, you must also use `-pedantic'. See section Invoking the C Preprocessor.

±âº» ¼³Á¤¿¡¼­, GNU C Àü󸮱â´Â Ç¥ÁØ¿¡ ¿ä±¸ÇÏ´Â ÀûÀº °ÍµéÀº ÇÏÁö ¾Ê´Â´Ù. ¿¹»óÇÏÁö ¾ÊÀº ÇÁ·Î±×·¥µéÀÇ Àǹ̿¡ ³î¶ö ¸¸ÇÑ º¯È­°¡ °ÅÀÇ µå¹® °ÍµéÀÌ ÀÌ °ÍµéÀÌ´Ù. ¾ö°ÝÇÑ ISO Ç¥ÁØ C¸¦ À§Çؼ­ ´ç½ÅÀº `-std=c89' ¶Ç´Â '-std=c99'¿É¼ÇÀ» ´ç½ÅÀÌ ¿øÇϴ ǥÁØ ¹öÀü¿¡¼­ »ç¿ëÇؾ߸¸ ÇÑ´Ù.  ¸ðµç ¼ö¿ë°¡´ÉÇÑ Áø´ÜÀ» ¾òÀ¸·Á¸é ¶ÇÇÑ ´ç½ÅÀº `-pedantic'À» »ç¿ëÇؾ߸¸ ÇÑ´Ù. IInvoking the C Preprocessor ºÎºÐÀ» ºÁ¶ó.

 


This document was generated on 27 November 2000 using the texi2html translator version 1.54.