| ARM Technical Support Knowledge Articles | |
Applies to: General Topics
Information in this article applies to:
I'm analyzing a .C source file made by another programmer that has a #define macro definition longer than 30 lines. At the end of each line I found a backslash return character sequence ( "\" ). What does this sequence mean and how does the environment deal with it?
The backslash character ('\') is the line continuation character. It must be the last character on a line. The preprocessor joins lines ending with a line continuation character into a single line (for purposes of preprocessing and compilation).
When you create a macro that is very long it is easier to read if the macro definition is split into multiple lines. The line continuation character allows this.
For example:
#define CALC ( a , b ) \ ( ( a * b ) + ( a - 2 ) - \ ( b * 2 ) )
The above example is equivalent to.:
#define CALC ( a , b ) ( ( a * b ) + ( a - 2 ) - ( b * 2 ) )
Article last edited on: 2004-06-29 15:46:27
Did you find this article helpful? Yes No
How can we improve this article?