This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: & and line continuation


Hey all, thanks for the responses. I tried a few of your suggestions
all to no avail.

I have included 3 screenshots of my examples for your scrutiny (maybe
Im screwing something else up, Ive been writing fortran for approx 3
days now).

(Im headed out the door right now, but ill check the version when i get back)

On 6/13/07, Tobias Burnus <burnus@net-b.de> wrote:
Hi,

andrealphus wrote:
> I get errors whenever I try and compile any code that has the "&" used
> for line continuation.
> example
>
>     WRITE (*,*) 'Why does gfortran not'
>      &'like me?'
Well, putting the & in the continuing line (in column 6) is fixed format
style, in free format one puts it at the end of the line which is to be
continued:
    WRITE (*,*) 'Why does gfortran not' &
     'like me?'

However, this does not work, but for a different reason; it is the same as:

write(*,*) 'Why does gfortran not' 'like me'

you need to add a comma between not' and 'like, e.g.

    WRITE (*,*) 'Why does gfortran not', &
     'like me?'

One could also use:
    WRITE (*,*) 'Why does gfortran not &
     & like me?'

Note that there are now only two ' and that there is an ampersand both
at the end of the first line and as (first non blank character) in the
second line.


> (I get the same error for continuing expressions..) > > number = 1 * 5 + & > 10

This works here:

program test
implicit none
integer :: number
number = 1 * 5 +    &
           10
write(*,*) number
end program test

Could you give a complete example which fails including the exact error
message and the gfortran version (gfortran -v).

Tobias



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]