replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Comment Embedded Directives
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Comment Embedded Directives

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
DanRRight



Joined: 10 Mar 2008
Posts: 2923
Location: South Pole, Antarctica

PostPosted: Tue Nov 20, 2012 5:00 pm    Post subject: Comment Embedded Directives Reply with quote

I get some nasty error for weeks which is hard to find because the compiler somehow hides it. I am getting Access Violation crash in some subroutine when compiled with /NOCHECK and when I turn all checks and undefs ON the damn error disappears (of course the code in debug mode works much slower)

So i turned to Comment Embedded Directives which i never used and even did not know before (when they appeared in FTN95? at the time of NET development?) in the hope to turn checking (or not checking) one part by one only for small portions of the code inside faulty subroutine. And unfortunately it does not work like i hoped
.
Will appreciate the clarifications how these directives work.

Here is smallest example of some artificial code where intentionally array elements 4 and 5 are not set and we will be trying to catch that. We compile the code this way

C>FTN95 A.FOR /DEBUG /LINK >z

and inside the code push the directive not to check anything before DO loop and only check DO loop on possible undefined variables turning just before it the UNDEF key ON

Code:
   Real a(5), b(5), c(5)

!FTN95$OPTIONS(nocheck)
   a(1)=1
   a(2)=2
   a(3)=3

   b(1)=10
   b(2)=20
   b(3)=30

   d=c(5)

!FTN95$OPTIONS(undef)
   do i=1,5
    c(i) = a(i)+b(i)
   enddo

   print*, c
   end


But what happening is that UNDEF starts to work for entire code before and after this directive and for example finds undefined variable at d=c(5) line.

What i am doing wrong ?

If i switch these directives, things become even more weird - i do not get the source code shown in the debugger which confirms that last directive suppresses previous ones in the entire code
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8210
Location: Salford, UK

PostPosted: Tue Nov 20, 2012 5:35 pm    Post subject: Reply with quote

This is just a quick reply without any testing but my understanding is that comment embedded directives must be applies before the subprogram to which they relate. /LIST will clarify this because it should indicate the options in force.
Back to top
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2923
Location: South Pole, Antarctica

PostPosted: Tue Nov 20, 2012 7:29 pm    Post subject: Reply with quote

Using them before the first line of subroutine was how older OPTIONS(....) command worked. I used it and it is helpful. But I thought this new syntax also means new functionality (and it would be cool by the way and extremely helpful one) when you can compile some parts of the subroutine/function using different compiler options. Syntax kind of resembling OpenMP parallelization instructions ...If this is not done it should be done!

Tried your suggestion with /LIST. It shows that program was compiled with UNDEF in both cases (when either nocheck or undef is used first in source code). The run though reveals that this is not true, the program above stops with error on undefined variable, while if change places of these comment embedded directives it runs without hiccup.


Last edited by DanRRight on Wed Nov 21, 2012 7:35 am; edited 2 times in total
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8210
Location: Salford, UK

PostPosted: Tue Nov 20, 2012 7:47 pm    Post subject: Reply with quote

I have noted your suggestion.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group