Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Statement terminators
Dear all,

A month or so ago, I posted to c.l.f asking about tips for writing a
Fortran lexer/parser. Many thanks to all those who gave me pointers;
I've made a start on the project, and I'm currently working on the code
for dealing with contination lines.

I've run into a little difficulty understanding how statement
continuation interacts with statement termination via semicolons.
Consider the following two lines of free-form code:

print *,'foo'; &
print *,'bar'

Is this code leagal? Both the Intel and Compaq compilers complain, with
the same error message:

Warning: test_continuation.f90, line 3: Continuation character illegal
as first non_blank in statement

Now, from my reading of the standard(1), there is nothing which
prohibits a statement terminator from being followed by blanks and then
a continuation character. In fact, the only restriction I can find on
the use of semicolons is in Section 3.3.1.3: 'A ";" shall not appear as
the first nonblank character on a line.' -- clearly not the case in the
code I give above.

I'd appreciate any input on this matter.

cheers,

Rich

(1) I've got a draft copy of the F2003 standard; I'm assuming that --
apart from the increase in the maximal number of continuation lines --
the specification for free-form source is the same as in F90/F95.

--
Dr Richard H D Townsend
Bartol Research Institute
University of Delaware

[ Delete VOID for valid email address ]

Report this thread to moderator Post Follow-up to this message
Old Post
Rich Townsend
09-25-04 09:00 AM


Re: Statement terminators
Rich Townsend wrote:
...
> Consider the following two lines of free-form code:
>
> print *,'foo'; &
> print *,'bar'
>
> Is this code leagal? Both the Intel and Compaq compilers complain, with
> the same error message:
>
> Warning: test_continuation.f90, line 3: Continuation character illegal
> as first non_blank in statement

Well, §3.3.1.3 of the F95 standard says that the & is used to continue
the current statement.  Well, it could be argued that there is no current
statement at the point where your & appears here.  The only statement
on that line has certainly been terminated already by the preceeding
semicolon.  I think this may be a bit too pedantic, but it could be the
logic they applied.

--
J. Giles

"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies."   --  C. A. R. Hoare



Report this thread to moderator Post Follow-up to this message
Old Post
James Giles
09-25-04 09:00 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Fortran archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:28 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.