Syntax error

Syntax error

Why is the compiler expecting only 2 entries when I have specified length 7?

program ttt
implicit none
CHARACTER(16) :: CCPROP(7) = &
( 'Viscosity', 'Therm Cond', 'Elec Cond', 'Surf Tension', 'Intfacial Tens', 'Self Diff', 'Mutual Diff' )
end

D:\test>ifort char.for /free
Intel(R) Visual Fortran Compiler Professional for applications running on IA-32, Version 11.1    Build 20100414 Package ID: w_cprof_p_11.1.065
Copyright (C) 1985-2010 Intel Corporation.  All rights reserved.

char.for(4): error #5082: Syntax error, found ',' when expecting one of: )
( 'Viscosity', 'Therm Cond', 'Elec Cond', 'Surf Tension', 'Intfacial Tens', 'Self Diff', 'Mutual Diff' )
---------------------------^
compilation aborted for char.for (code 1)

I thought this syntax was valid, but changed to DATA and it worked OK.  Is this syntax not valid?

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

You have the wrong syntax for an array constructor. It should be either (/.../) or [...].

Steve - Intel Developer Support

What was your intent with this statement? Its complaining about your syntax. the use of the "=" suggests that you were intending it to be a PARAMETER statement, but you've left out that key word. If that was your intent, then change it to
CHARACTER(16), PARAMETER :: CCPROP(7) = &
[ 'Viscosity', 'Therm Cond', 'Elec Cond', 'Surf Tension', 'Intfacial Tens', 'Self Diff', 'Mutual Diff' ]
or
CHARACTER(16), PARAMETER :: CCPROP(7) = &
(/ 'Viscosity', 'Therm Cond', 'Elec Cond', 'Surf Tension', 'Intfacial Tens', 'Self Diff', 'Mutual Diff' /)

and it will declare CCPROP(7) as parameters with the 7 values.

If an array constructor, then what Steve said. Your delimiters were wrong.

Sorry yes I did originally have PARAMETER there, but removed it trying to figure out syntax. Thanks for the responses.

It could be a variable initialization - doesn't have to be PARAMETER.

Steve - Intel Developer Support

Leave a Comment

Please sign in to add a comment. Not a member? Join today