Frank Heckenbach wrote:
Adriaan van Os wrote:
vanam srihari kumar wrote:
Dear All
I am porting the code developed using pc and cc compilers on solaris 2.6 to solaris 2.8 with gcc and gpc compilers.
I am using the makefile from the older version.In that makefile, linker(ld) is called explicitly.
Right now I am facing the below problems
- related to real array constant intialization.
TYPE MaxCPlus_RArray = ARRAY[1..MaxCplus] OF REAL; Maxcomp_Array = ARRAY[1..Maxcomp] OF REAL;
CONST wPAF : Maxcomp_Array = [ 0.040, 0.225,
<snip>
0 ];
it is giving following error
/home/kvsspl/esipas81/flo/joint_lib.inc:125: incompatible types in initialization /home/kvsspl/esipas81/flo/joint_lib.inc:125: initial value is of wrong type /home/kvsspl/esipas81/flo/joint_lib.inc:125: set constructor elements must be of ordinal type
<snip>
Replace [ ] with ( ).
Yes. Seems like Sun Pascal has yet another intialization syntax (besides standard [1: 0.040; ...] and BP (0.040, ...)).
The problem with this syntax is that it really looks like set constants ([1, 2, 3]), especially if the array fields are ordinal types. So changing it should also make the code somewhat more readable IMHO.
Current GPC version allows:
CONST Maxcomp = 3; TYPE Maxcomp_Array = ARRAY[1..Maxcomp] OF REAL; CONST wPAF : Maxcomp_Array = [ 0.040; 0.225; 0 ];
(with semicolons as separators). The compiler (and presumably human readers too) use type information to decide the meaning of the list. I think that we can easily add Sun syntax (if we want to).