Scheduled Downtime
On Tuesday 24 October 2023 @ 5pm MT the forums will be in read only mode in preparation for the downtime. On Wednesday 25 October 2023 @ 5am MT, this website will be down for maintenance and expected to return online later in the morning.
Normal Operations
The forums are back online with normal operations. If you notice any issues or errors related to the forums, please reach out to help@ucar.edu

Meaning of # in code

I have a general question regarding the .F90 files that make up CAM3. What does the # mean ? And how is it different from the ! ?

For example, here's some code from the history.F90 file from the "Control" directory of the source code:

#if ( ! defined COUP_SOM ) && ( ! defined COUP_CSM )
use sst_data, only: sst
#endif

#include
#include
!
! Local variables
!
character*80 name ! variable name
character*80 filename ! filename to write


I believe the that "!" is just a comment symbol, similar to "c" in various versions of fortran. What about the #?
 

olson

Member
You are correct that the ! and # are different. ! is a comment, while # delimits "cpp" directives which
are used to modify code just prior to compilation.
 
Top