Skip to content

trailing-backslash (C051)

This rule is turned on by default.

What does it do?

Checks if a backslash is the last character on a line

Why is this bad?

When compilers use the C preprocessor to pre-process Fortran files the \ character is treated as a line continuation character by the C preprocessor, potentially causing lines to be merged into one.

Example

When this Fortran program is passed through the C preprocessor,

program t
    implicit none
    real :: A

    ! Just a comment \
    A = 2.0
    print *, A
 end
it will end up with the variable assignment A placed onto the comment line,
program t
   implicit none
   real :: A

   ! Just a comment    A = 2.0

   print *, A
end
which causes the assignment to not be compiled.