Syntax of line in gcc 295 and previous the string

Info icon This preview shows pages 60–62. Sign up to view the full content.

View Full Document Right Arrow Icon
Syntax of ‘ #line In GCC 2.95 and previous, the string constant argument to ‘ #line ’ was treated the same way as the argument to ‘ #include ’: backslash escapes were not honored, and the string ended at the second ‘ " ’. This is not compliant with the C standard. In GCC 3.0, an attempt was made to correct the behavior, so that the string was treated as a real string constant, but it turned out to be buggy. In 3.1, the bugs have been fixed. (We are not fixing the bugs in 3.0 because they affect relatively few people and the fix is quite invasive.) 12 Invocation Most often when you use the C preprocessor you will not have to invoke it explicitly: the C compiler will do so automatically. However, the preprocessor is sometimes useful on its own. All the options listed here are also acceptable to the C compiler and have the same meaning, except that the C compiler has different rules for specifying the output file. Note: Whether you use the preprocessor by way of gcc or cpp , the compiler driver is run first. This program’s purpose is to translate your command into invocations of the programs that do the actual work. Their command line interfaces are similar but not identical to the documented interface, and may change without notice. The C preprocessor expects two file names as arguments, infile and outfile . The prepro- cessor reads infile together with any other files it specifies with ‘ #include ’. All the output generated by the combined input files is written in outfile . Either infile or outfile may be ‘ - ’, which as infile means to read from standard input and as outfile means to write to standard output. Also, if either file is omitted, it means the same as if ‘ - ’ had been specified for that file. Unless otherwise noted, or the option ends in ‘ = ’, all options which take an argument may have that argument appear either immediately after the option, or with a space between option and argument: ‘ -Ifoo ’ and ‘ -I foo ’ have the same effect. Many options have multi-letter names; therefore multiple single-letter options may not be grouped: ‘ -dM ’ is very different from ‘ -d -M ’. -D name Predefine name as a macro, with definition 1 . -D name = definition The contents of definition are tokenized and processed as if they appeared dur- ing translation phase three in a ‘ #define ’ directive. In particular, the definition will be truncated by embedded newline characters. If you are invoking the preprocessor from a shell or shell-like program you may need to use the shell’s quoting syntax to protect characters such as spaces that have a meaning in the shell syntax. If you wish to define a function-like macro on the command line, write its argument list with surrounding parentheses before the equals sign (if any).
Image of page 60

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Chapter 12: Invocation 57 Parentheses are meaningful to most shells, so you will need to quote the option.
Image of page 61
Image of page 62
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern