| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| Since the following code is only accepted by g95 and not by gfortran-4.2.3 or the intel compiler 10.1, I was wondering if I got the syntax right. module array_constructor implicit none character(len=14), dimension(5), parameter :: & var_names = [character(len=14) :: & 'YEAR', 'COMPCODE', 'RECEPTYPE', 'NCOLS', 'NROWS'] end module array_constructor If the syntax is right, I would like to know if there are other compilers available for x86 under Linux that accept this Fortran 2003 array constructor, since I don't like to be dependent on just one compiler. Thanks, Cornelis |
|
#2
| |||
| |||
| On Sep 1, 3:42*pm, Cornelis <cwdeg...@gmail.com> wrote: > Since the following code is only accepted by g95 and not by > gfortran-4.2.3 or the intel compiler 10.1, I was wondering if I got > the syntax right. > > module array_constructor > * implicit none > > * character(len=14), dimension(5), parameter :: & > * * * *var_names = [character(len=14) :: & > * * * *'YEAR', 'COMPCODE', 'RECEPTYPE', 'NCOLS', 'NROWS'] > > end module array_constructor > > If the syntax is right, I would like to know if there are other > compilers available for x86 under Linux that accept this Fortran 2003 > array constructor, since I don't like to be dependent on just one > compiler. > > Thanks, > > Cornelis module array_constructor implicit none character(len=14), dimension(5), parameter :: var_names & & = ['YEAR', 'COMPCODE', 'RECEPTYPE', 'NCOLS', 'NROWS'] end module works on Intel 10.1 and gfortran 4.2.1 |
|
#3
| |||
| |||
| In article <d542448a-2ace-49cd-a408-b52a1e91910f@e39g2000hsf.googlegroups.com>, Cornelis <cwdegier@gmail.com> writes: > Since the following code is only accepted by g95 and not by > gfortran-4.2.3 or the intel compiler 10.1, I was wondering if I got > the syntax right. > > module array_constructor > implicit none > > character(len=14), dimension(5), parameter :: & > var_names = [character(len=14) :: & > 'YEAR', 'COMPCODE', 'RECEPTYPE', 'NCOLS', 'NROWS'] > > end module array_constructor > > If the syntax is right, I would like to know if there are other > compilers available for x86 under Linux that accept this Fortran 2003 > array constructor, since I don't like to be dependent on just one > compiler. You need gfortran 4.4.0. See the wiki. -- Steve http://troutmask.apl.washington.edu/~kargl/ |
|
#4
| |||
| |||
| rusi_pathan <tabrezali@gmail.com> wrote: > On Sep 1, 3:42 pm, Cornelis <cwdeg...@gmail.com> wrote: > > Since the following code is only accepted by g95 and not by > > gfortran-4.2.3 or the intel compiler 10.1, I was wondering if I got .... > > character(len=14), dimension(5), parameter :: & > > var_names = [character(len=14) :: & > > 'YEAR', 'COMPCODE', 'RECEPTYPE', 'NCOLS', 'NROWS'] Yes, that looks fine. As you correctly note, it is an f2003 form. I'm sure the other compilers wil get there eventually, but I can't give you a timeline. > character(len=14), dimension(5), parameter :: var_names & > & = ['YEAR', 'COMPCODE', 'RECEPTYPE', 'NCOLS', 'NROWS'] > > works on Intel 10.1 and gfortran 4.2.1 That, on the other hand, is *NOT* valid in any version of the standard. Just because some compilers accept it doesn't mean it is valid. Might I ask whether those compilers at least give a warning for the nonstandard form when you ask for warnings about standard violation? If they don't, I'd suggest filing a bug report. While it isn't one of the particular warnings required by the standard, and thus not strictly a "bug" in terms of standard compliance, I'd consider it a "bug" in quality of implementation to fail to give such a warning. -- Richard Maine | Good judgement comes from experience; email: last name at domain . net | experience comes from bad judgement. domain: summertriangle | -- Mark Twain |
|
#5
| |||
| |||
| Thanks, Richard, for your elaborate answer. Both gfortran-4.2 and ifort 10.1 accept rusi's code by default, but they don't accept it when issued with an option to confirm to the f2003 standard, -std=f2003 and -e03 respectively. Steven, thanks: gfortran-4.4 accepts the orginal code and rejects rusi's code by default. Cornelis On Sep 1, 11:27*pm, nos...@see.signature (Richard Maine) wrote: > rusi_pathan <tabrez...@gmail.com> wrote: > > On Sep 1, 3:42 pm, Cornelis <cwdeg...@gmail.com> wrote: > > > Since the following code is only accepted by g95 and not by > > > gfortran-4.2.3 or the intel compiler 10.1, I was wondering if I got > ... > > > * character(len=14), dimension(5), parameter :: & > > > * * * *var_names = [character(len=14) :: & > > > * * * *'YEAR', 'COMPCODE', 'RECEPTYPE', 'NCOLS', 'NROWS'] > > Yes, that looks fine. As you correctly note, it is an f2003 form. I'm > sure the other compilers wil get there eventually, but I can't give you > a timeline. > > > * character(len=14), dimension(5), parameter :: var_names & > > * * & = ['YEAR', 'COMPCODE', 'RECEPTYPE', 'NCOLS', 'NROWS'] > > > works on Intel 10.1 and gfortran 4.2.1 > > That, on the other hand, is *NOT* valid in any version of the standard. > Just because some compilers accept it doesn't mean it is valid. > > Might I ask whether those compilers at least give a warning for the > nonstandard form when you ask for warnings about standard violation? If > they don't, I'd suggest filing a bug report. While it isn't one of the > particular warnings required by the standard, and thus not strictly a > "bug" in terms of standard compliance, I'd consider it a "bug" in > quality of implementation to fail to give such a warning. > > -- > Richard Maine * * * * * * * * * *| Good judgement comes from experience; > email: last name at domain . net | experience comes from bad judgement. > domain: summertriangle * * * * * | *-- Mark Twain |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.