replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Using VPARAM
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 

Using VPARAM

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



Joined: 05 Jul 2006
Posts: 299

PostPosted: Sat Mar 23, 2013 4:33 am    Post subject: Using VPARAM Reply with quote

Below is a trivial program with a simple error (executable statement occurring before a CONTAINS statement) that should prevent compilation.

Code:
MODULE m1
#ifdef A
 i=1
#endif
END MODULE m1


If I compile using the following command, there is no error, which is appropriate since ifdef A is undefined:

FTN95 <filename>.f95 /CFPP

However, if I try using either of the following commands I get an error message:

FTN95 <filename>.f95 /CFPP /VPARAM A 0
FTN95 <filename>.f95 /CFPP /VPARAM A 1

It makes sense to me that the second command should generate an error, but why does the first one not work?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sat Mar 23, 2013 9:52 am    Post subject: Reply with quote

It would make sense to a C programmer.

The concept is that the parameter is set not that it is set to a particular value.

See ftn95.chm under FTN95 Fortran language extensions->The C-style preprocessor.
Back to top
View user's profile Send private message AIM Address
simon



Joined: 05 Jul 2006
Posts: 299

PostPosted: Sat Mar 23, 2013 1:29 pm    Post subject: Reply with quote

Thanks for the quick response Paul, especially on the weekend!

So I would need to use the Fortran conditional compilation statements as follows:

Code:
MODULE m1
CIF (A) THEN
 i=1
CENDIF
END MODULE m1


which does compile as expected with /VPARAM A 1 and /VPARAM A 0.

But these are Fortran extensions, correct? Using the C-format, I can get my code to compile with other compilers. I'm not sure about CIF. If not I am sure I can work around that.
Back to top
View user's profile Send private message
davidb



Joined: 17 Jul 2009
Posts: 560
Location: UK

PostPosted: Sat Mar 23, 2013 5:27 pm    Post subject: Reply with quote

Does this do what you want?

Code:

MODULE m1
#ifdef A
#if A
 i=1
#endif
#endif
END MODULE m1


These don't give compile errors

FTN95 <filename>.f95 /CFPP
FTN95 <filename>.f95 /CFPP /VPARAM A 0

This gives a compiler error

FTN95 <filename>.f95 /CFPP /VPARAM A 1
_________________
Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl
Back to top
View user's profile Send private message
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