Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ C language preprocessor command     - Ubuntu 14.04 compile RT288x_SDK / toolchain / squashfs3.2-r2 Error (Linux)

- CentOS modify yum update source (Linux)

- Bash variable expansion modifier (Programming)

- Java multi-threaded in a three way (inheritance, implementation, anonymous inner classes) (Programming)

- Ubuntu and Derivatives users install the latest KKEdit 0.0.31 (Linux)

- How to Upgrade Ubuntu GNOME 14.10 to GNOME 3.16 Desktop (Linux)

- File easier to compare tools under Linux (Linux)

- How do I upgrade to Ubuntu 15.04 (Beta) (Linux)

- How to install new fonts on Ubuntu 14.04 and 14.10 (Linux)

- Fedora 8 configured Heartbeat (Linux)

- Learning how to teach safety system to prevent your own IP leakage (Linux)

- Linux User Rights Study Notes (Linux)

- RMAN backup file is much larger than the size of the database Cause Analysis (Database)

- C ++ Supplements - References (Lvalue Reference, Rvalue Reference) (Linux)

- Check the Linux server performance with ten or so commands in a minute (Server)

- Python objects (Programming)

- How to install Wine 1.7.20 under Ubuntu or Linux Mint (Linux)

- Java 8 perspective annotation types (Programming)

- CentOS7 install NTFS-3G driver (Linux)

- Install apr support for Tomcat on Linux (Server)

 
         
  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:      
 
- Sort sql MySQL 5.6 upgrade slow Cause Analysis (Database)
- STL source code analysis - iterator each container classification (Programming)
- Bash code injection attacks through a special environment variable (Linux)
- Analytical Ceph: handle network layer (Server)
- Linux command line to put on your coat GUI (Linux)
- Migrate Oracle database files to ASM (Database)
- Binary Packages Golang (Linux)
- Some safety precautions of Linux servers (Linux)
- Commonly used Linux system camouflage method (Linux)
- Python MySQL database connection (Database)
- Oracle 12C RAC on temporary table space Enlighten (Database)
- Kubernetes cluster deployment (Server)
- Several SQL Server data migration / Export Import Practice (Database)
- Delay for the specified IP port analog network to send and receive packets on Linux (Linux)
- grep command usage (Linux)
- Android basics summary article (Programming)
- Linux `dirname $ 0` (Linux)
- Development environment to build MEAN In Ubuntu 15.10 (Server)
- JDK installation and configuration environment variable under linuxb (Linux)
- Use Python to perform system commands common usage (Programming)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.