Next: , Previous: Libraries, Up: Program Behavior


4.4 Formatting Error Messages

Error messages from compilers should look like this:

     source-file-name:lineno: message

If you want to mention the column number, use one of these formats:

     source-file-name:lineno:column: message
     source-file-name:lineno.column: message
     

Line numbers should start from 1 at the beginning of the file, and column numbers should start from 1 at the beginning of the line. (Both of these conventions are chosen for compatibility.) Calculate column numbers assuming that space and all ASCII printing characters have equal width, and assuming tab stops every 8 columns.

The error message can also give both the starting and ending positions of the erroneous text. There are several formats so that you can avoid redundant information such as a duplicate line number. Here are the possible formats:

     source-file-name:lineno-1.column-1-lineno-2.column-2: message
     source-file-name:lineno-1.column-1-column-2: message
     source-file-name:lineno-1-lineno-2: message

When an error is spread over several files, you can use this format:

     file-1:lineno-1.column-1-file-2:lineno-2.column-2: message

Error messages from other noninteractive programs should look like this:

     program:source-file-name:lineno: message