What does a constant that begins with a '#' and/or ends with a 'c' mean in Fortran?

fortran, gfortran

Solution

What you are looking at is non-standard Fortran. In Compaq Fortran the `#` is used to prefix a hexadecimal constant, as one of the comments suggests. As the other comment suggests the standard prefix for hexadecimal constants is Z and the digits should be enclosed in '' marks. So non-standard `#2020202C` should translate to standard `Z'2020202C'`.

As for the trailing `C`, I think that's just a hexadecimal digit.

Problem

I need to compile an old Fortran program that previously used a Compaq Fortran compiler. I can't seem to figure out what a constant that begins with a '#' is. gfortran says its a syntax error and I can't seem to find many answers. ``` CHAR2 = IATA(KK) - #20202030 CHAR3 = IATA(KK+1) - #20202030 ``` What kind of constant is `#20202030`? According to the comments this code should take two ASCII characters in IATA and convert them to binary. Can someone explain this? Further down: ``` IF (IATA(KK+1) .EQ. #2020202C) THEN ``` Now there is a 'C' at the end. What does that mean? How can I port this over to gfortran? It feels like I'm missing something obvious. Please enlighten me. Thanks!

Original source