Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ C language preprocessor command     - Linux System Getting Started Tutorial: Five image processing software (Linux)

- Zombie process under Linux (Linux)

- Oracle Character Set Summary (Database)

- Vim simple configuration (Linux)

- Lua4.0 interpreter documents (Programming)

- Spark build standalone version cluster (Server)

- osprofiler use OpenStack Cinder Lane (Server)

- Linux system firewall defense network attacks (Linux)

- Linux five security TIPS (Linux)

- AWK principles and commands and file input (Linux)

- Through eight skills to let you become a super Linux end-user (Linux)

- Linux System Getting Started Learning: Linux common log file (Linux)

- Linux find and xargs (Linux)

- Ubuntu install VMware Workstation 11 tutorials at 14.04 / 14.10 (Linux)

- Oracle RAC 10.2.0.5 upgrade to 11.2.0.4 problems encountered (Database)

- How to configure Ceph stored on CentOS 7.0 (Server)

- Git 2.5 increase in the working tree, triangle improved workflow performance (Linux)

- How to install GIMP 2.8.16 in Ubuntu 16.04,15.10,14.04 (Linux)

- Linux Powerful command Awk Introduction (Linux)

- PostgreSQL 9.3.2 Json type of use (Database)

 
         
  C language preprocessor command
     
  Add Date : 2017-04-13      
         
         
         
  The first step in dealing with C language compiler after the pretreatment, is to deal with the .c file .i file. When the compiler to do some preprocessing expand the replacement process.

1> header file to start soon #include "stdio.h" file similar expanded.

2> macro definition replacement work, the program is about to replace the contents of the macro definition good.

#include "stdio.h"

#define R 10

int main ()

{

    int a = R;

}

After preprocessor code changes

//...stdio.h contents of not showing

// Place the macro definition has been replaced in the program

int main ()

{

    int a = 10;
return 0;

}

Replace macro to do is replace a whole, and syntax-independent, it does not follow the rules of grammar.

Macro definitions generally used in two ways, one is to define a constant, and the other is to define a macro function.

#define N (n, m) n + m // macro definition

int main ()

{

        int c;

        c = N (1,2); // sum of 1 and 2
return 0;

}

In fact, after pre-treatment becomes

int main ()

{

    int c;

    c = 1 + 2;
return 0;

}

Another application macro function, because the macro syntax definition does not consider it just as a whole substitution, so you can write without considering the type of function variables, and this is his advantage

For example, the following code:

#define N (n, m) n + m // macro definition

int main ()

{

    int e = N (10,20) * N (10,20) // After preprocessing is int e = 10 + 20 * 10 + 20;

// The above error is easy to count! !

    return 0;

}

3> Conditional Compilation: Some statements in the hope that when the conditions are met to compile.

#ifdef identifier

// Block 1

#else

// Block 2

#endif

When the identifier has been defined, only 1 block compiled participate

At the same time of its use and define a replacement job is done.

With some knowledge of the C language. . . See the video to learn Linux C language.
     
         
         
         
  More:      
 
- installation process of Matlab 2012a under Ubuntu 14.04 (Linux)
- How to find on Linux and delete duplicate files: FSlint (Linux)
- Fedora 22 install Adobe Flash Player (Linux)
- Linux, how to filter, split, and merge pcap file (Linux)
- Commentary Apache + Tomcat + JK implement Tomcat clustering and load (Server)
- C ++ input and output summary _ Input (Programming)
- Log4Net (Linux)
- CentOS7 virtual machine settings, and bridging problems (Linux)
- Zabbix monitors Nginx status (Server)
- Shilpa Nair interview experience sharing RedHat Linux package management (Linux)
- Open source backup software installed on Ubuntu Systemback 1.6.201 (Linux)
- The Linux firewall is configured to use proxy (Linux)
- pscp use Detailed Windows and Linux each file transfer tool (Linux)
- CentOS yum configuration under local sources (Linux)
- CentOS 6.x Basic System Optimization after installation (Linux)
- Generic mechanism C11 standard (Programming)
- Configuring Android NDK development environment for Mac OS X (Linux)
- DRBD Principle and Features Overview (Server)
- How to adjust the system time CentOS (Linux)
- How to remove the files inside the privacy of data on Linux (Linux)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.