CL /Bk



The optional argument consists of whatever follows immediately within the same command-line token.


This option has no syntactic relations with other options: it does not override any; it is not incompatible with any; it has no prerequisites.

This option is handled entirely within CL. It generates nothing that passes to any compiler module.

However, the /Bk option may affect the -il option that CL anyway generates for the front-end, in-between and back-end compiler modules. Specifically, if the pathname argument is given, it becomes the -il argument.


Compilation of any one source file typically involves creation of some number of so-called intermediate files by one or another of the compiler modules, mostly to pass information from the front-end (C1 or C1XX) to the back-end (C2). Unlike object files however, they are not an end-product of compilation and are ordinarily deleted by CL once compilation completes (successfully or not).

The general plan is that the intermediate files for any one source file are all in the one directory and all have their names formed by appending a two-letter code to a common base. The directory and base, composed as a pathname, then make a naming pattern for the set of intermediate files that correspond to that one source file. Within this pattern, the compiler modules may create and use intermediate files as they see fit. CL’s role is just to establish the naming pattern, communicate it to each compiler module via the -il option, and to delete such intermediate files that CL anticipates may remain when the modules are all done. The two-letter codes that CL anticipates will be appended to the template are presently db, ex, gl, in, lk, md and sy.

The naming pattern that CL ordinarily computes for intermediate files and passes as the -il argument is


where tmp stands for whatever path is named by the TMP environment variable (defaulting in turn to tmp and the conjunctive backslash being omitted), and xxx and 00000 stand respectively for three lower-case letters and five decimal digits that CL generates more or less randomly.

The /Bk option directs that intermediate files be kept after compilation and allows specification of the naming pattern.

Use of /Bk with an argument affects the order in which CL executes compiler modules when building more than one source file. The usual order (enabled by /ZM, which is set as an initial option) is to execute the same compiler module for as many source files as possible before proceeding to another compiler module. This order requires a different naming pattern for each set of intermediate files. To provide /Bk with a pathname is to specify one naming pattern for all intermediate files. Each source file is therefore compiled to completion before proceeding to another source file (as if /ZM- were given). The intermediate files that are kept at the end of the build relate to the last C/C++ source file that was compiled.

For the work of /Bk but with the addition of suppressing the front-end C and C++ compilers, use the /BK option.