You copied the Doc URL to your clipboard.


Generates raw listing information for a source file.

The name of the raw listing file defaults to the name of the input file with the filename extension .lst.

If you specify multiple source files on the command line, the compiler generates listings for all of the source files, writing each to a separate listing file whose name is generated from the corresponding source file name. However, when --multifile is used, a concatenated listing is written to a single listing file, whose name is generated from the first source file name.


Typically, you use raw listing information to generate a formatted listing. The raw listing file contains raw source lines, information on transitions into and out of include files, and diagnostics generated by the compiler. Each line of the listing file begins with any of the following key characters that identifies the type of line:


A normal line of source. The rest of the line is the text of the line of source.


The expanded form of a normal line of source. The rest of the line is the text of the line. This line appears following the N line, and only if the line contains nontrivial modifications. Comments are considered trivial modifications, and macro expansions, line splices, and trigraphs are considered nontrivial modifications. Comments are replaced by a single space in the expanded-form line.


A line of source skipped by an #if or similar. The rest of the line is text.

Note The #else, #elseif, or #endif that ends a skip is marked with an N.

Indicates a change in source position. That is, the line has a format similar to the # line-identifying directive output by the preprocessor:

L line-number "filename" key

where key can be:


For entry into an include file.


For exit from an include file.

Otherwise, key is omitted. The first line in the raw listing file is always an L line identifying the primary input file. L lines are also output for #line directives where key is omitted. L lines indicate the source position of the following source line in the raw listing file.


Indicates a diagnostic, where:


Indicates a remark.


Indicates a warning.


Indicates an error.

The line has the form:

type "filename" line-number column-number message-text

where type can be R, W, or E.

Errors at the end of file indicate the last line of the primary source file and a column number of zero.

Command-line errors are errors with a filename of "<command line>". No line or column number is displayed as part of the error message.

Internal errors are errors with position information as usual, and message-text beginning with (Internal fault).

When a diagnostic message displays a list, for example, all the contending routines when there is ambiguity on an overloaded call, the initial diagnostic line is followed by one or more lines with the same overall format. However, the code letter is the lowercase version of the code letter in the initial line. The source position in these lines is the same as that in the corresponding initial line.


/* main.c */
#include <stdbool.h>
int main(void)

Compiling this code with the option --list produces the raw listing file:

L 1 "main.c"
N#include <stdbool.h>
L 1 "...\include\...\stdbool.h" 1
N/* stdbool.h */
N  #ifndef __cplusplus /* In C++, 'bool', 'true' and 'false' and keywords */
N    #define bool _Bool
N    #define true 1
N    #define false 0
N  #endif
L 2 "main.c" 2
Nint main(void)
N   return(true);
X   return(1);