Hi,
subject says all: is the attached code legal? two compilers accept it,
one does not.
Thanks
Salvatore
---------------------------------------- usemod2.f90
-------------------
module s_type_mod
type s_foo_type
real(kind(1.e0)), allocatable :: v(:)
end type s_foo_type
end module s_type_mod
module s_foo_mod
use s_type_mod
interface foobar
subroutine s_foobar(x)
use s_type_mod
type(s_foo_type), intent (inout) :: x
end subroutine s_foobar
end interface
end module s_foo_mod
module d_type_mod
type d_foo_type
real(kind(1.d0)), allocatable :: v(:)
end type d_foo_type
end module d_type_mod
module d_foo_mod
use d_type_mod
interface foobar
subroutine d_foobar(x)
use d_type_mod
type(d_foo_type), intent (inout) :: x
end subroutine d_foobar
end interface
end module d_foo_mod
module foo_mod
use s_foo_mod
use d_foo_mod
end module foo_mod
subroutine s_foobar(x)
use foo_mod, protect => s_foobar
type(s_foo_type), intent (inout) :: x
if (.not.allocated(x%v)) allocate(x%v(10))
end subroutine s_foobar
subroutine d_foobar(x)
use foo_mod, protect => d_foobar
type(d_foo_type), intent (inout) :: x
if (.not.allocated(x%v)) allocate(x%v(10))
end subroutine d_foobar
program test
use foo_mod
type(d_foo_type) :: z
call foobar(z)
end program test
|
|
0
|
|
|
|
Reply
|
sfilippone (77)
|
5/29/2008 2:03:55 PM |
|
Before someone asks, the error is about the renaming of the specific
versions of foobar
as in
use foo_mod, protect => s_foobar
all three compilers support ALLOCATABLEs in derived types as per
tr15581
Thanks
On 29 Mag, 16:03, Salvatore <sfilipp...@uniroma2.it> wrote:
> Hi,
> subject says all: is the attached code legal? two compilers accept it,
> one does not.
>
> Thanks
> Salvatore
> ---------------------------------------- usemod2.f90
> -------------------
> module s_type_mod
> type s_foo_type
> real(kind(1.e0)), allocatable :: v(:)
> end type s_foo_type
> end module s_type_mod
> module s_foo_mod
> use s_type_mod
> interface foobar
> subroutine s_foobar(x)
> use s_type_mod
> type(s_foo_type), intent (inout) :: x
> end subroutine s_foobar
> end interface
> end module s_foo_mod
>
> module d_type_mod
> type d_foo_type
> real(kind(1.d0)), allocatable :: v(:)
> end type d_foo_type
> end module d_type_mod
>
> module d_foo_mod
> use d_type_mod
>
> interface foobar
> subroutine d_foobar(x)
> use d_type_mod
> type(d_foo_type), intent (inout) :: x
> end subroutine d_foobar
> end interface
> end module d_foo_mod
>
> module foo_mod
> use s_foo_mod
> use d_foo_mod
> end module foo_mod
>
> subroutine s_foobar(x)
> use foo_mod, protect => s_foobar
> type(s_foo_type), intent (inout) :: x
>
> if (.not.allocated(x%v)) allocate(x%v(10))
> end subroutine s_foobar
>
> subroutine d_foobar(x)
> use foo_mod, protect => d_foobar
> type(d_foo_type), intent (inout) :: x
>
> if (.not.allocated(x%v)) allocate(x%v(10))
> end subroutine d_foobar
>
> program test
> use foo_mod
> type(d_foo_type) :: z
>
> call foobar(z)
>
> end program test
|
|
0
|
|
|
|
Reply
|
sfilippone (77)
|
5/29/2008 2:07:47 PM
|
|
Salvatore <sfilippone@uniroma2.it> wrote:
> Before someone asks, the error is about the renaming of the specific
> versions of foobar
Yes, I was going to ask. Without that, it simply wasn'y worth my time to
try to guess what someone might think was illegal.
> > subject says all: is the attached code legal? two compilers accept it,
> > one does not.
I see nothing wrong with it. Nor can I particularly think of any reason
why it would even be questionable. Prevention of name conflicts is one
of the things renaming is for.
There aren't any special rules related to specific procedure names that
would prohibit this. It is reasonably common to not make specific names
public at all. Some people might misunderstand that and think that would
prohibit use of the specific, but it doesn't. It just prohibits use of
the specific by that name; it has no affect on use by the generic name.
But anyway, that's not what you are doing. Its just an alternate way to
do something simillar.
--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
|
|
0
|
|
|
|
Reply
|
nospam47 (9742)
|
5/29/2008 3:42:02 PM
|
|
On May 29, 7:07 am, Salvatore <sfilipp...@uniroma2.it> wrote:
> Before someone asks, the error is about the renaming of the specific
> versions of foobar
> as in
> use foo_mod, protect => s_foobar
Can you provide the text of the error message?
Bob Corbett
|
|
0
|
|
|
|
Reply
|
robert.corbett2 (862)
|
5/30/2008 6:40:35 AM
|
|
On 30 Mag, 08:40, robert.corb...@sun.com wrote:
> On May 29, 7:07 am, Salvatore <sfilipp...@uniroma2.it> wrote:
>
> > Before someone asks, the error is about the renaming of the specific
> > versions of foobar
> > as in
> > use foo_mod, protect => s_foobar
>
> Can you provide the text of the error message?
>
> Bob Corbett
Actually the culprit is gfortran, the error message is
Error: Name 'foobar' at (1) is an ambiguous reference to 'foobar' from
module 's_foo_mod'
At first I thought it was about the renaming, but it seems to be
something more fundamental; anyway there is nothing ambiguous in this
example (at least, nothing that I can see, and Richard Maine seems to
think the same).
Thanks
Salvatore Filippone
|
|
0
|
|
|
|
Reply
|
sfilippone (77)
|
5/30/2008 12:50:42 PM
|
|
Salvatore wrote:
> On 30 Mag, 08:40, robert.corb...@sun.com wrote:
>> On May 29, 7:07 am, Salvatore <sfilipp...@uniroma2.it> wrote:
>>
>>> Before someone asks, the error is about the renaming of the specific
>>> versions of foobar
>>> as in
>>> use foo_mod, protect => s_foobar
>> Can you provide the text of the error message?
>>
>> Bob Corbett
>
> Actually the culprit is gfortran, the error message is
> Error: Name 'foobar' at (1) is an ambiguous reference to 'foobar' from
> module 's_foo_mod'
>
> At first I thought it was about the renaming, but it seems to be
> something more fundamental; anyway there is nothing ambiguous in this
> example (at least, nothing that I can see, and Richard Maine seems to
> think the same).
Which version of gfortran? I know that there have been some hiccups
with handling ambiguity (or lack of some) properly, so you may have run
into a bug which was fixed in 4.3 or newer.
|
|
0
|
|
|
|
Reply
|
craig.powers (222)
|
5/30/2008 6:12:33 PM
|
|
On 30 Mag, 20:12, Craig Powers <craig.pow...@invalid.invalid> wrote:
> Salvatore wrote:
> > On 30 Mag, 08:40, robert.corb...@sun.com wrote:
> >> On May 29, 7:07 am, Salvatore <sfilipp...@uniroma2.it> wrote:
>
> >>> Before someone asks, the error is about the renaming of the specific
> >>> versions of foobar
> >>> as in
> >>> use foo_mod, protect => s_foobar
> >> Can you provide the text of the error message?
>
> >> Bob Corbett
>
> > Actually the culprit is gfortran, the error message is
> > Error: Name 'foobar' at (1) is an ambiguous reference to 'foobar' from
> > module 's_foo_mod'
>
> > At first I thought it was about the renaming, but it seems to be
> > something more fundamental; anyway there is nothing ambiguous in this
> > example (at least, nothing that I can see, and Richard Maine seems to
> > think the same).
>
> Which version of gfortran? I know that there have been some hiccups
> with handling ambiguity (or lack of some) properly, so you may have run
> into a bug which was fixed in 4.3 or newer.
It's in both 4.3.0 and in the development snapshot. The issue has
already been notifed to the GCC/gfortran crew.
Salvatore
|
|
0
|
|
|
|
Reply
|
sfilippone (77)
|
5/31/2008 4:40:09 PM
|
|
|
6 Replies
42 Views
(page loaded in 0.096 seconds)
Similiar Articles: Laws texture similarity measures #2 - comp.soft-sys.matlab ...Hi, I am trying to develop a programm about image retrieval using Laws texture similarity measures. The images are sent from VB and Matlab is used to... Solving 2 non linear equations with 2 unknown - comp.soft-sys ...These are 2 Law of Cosines equation, i need your help to solve this: (r1+150)^2 = (r1+200)^2 + 499.1^2 -2*(r1+200) * 499.1 * cos(16.177 ) r1^2 =... Diffusion Problem, 2nd law of Fick, pdepe - comp.soft-sys.matlab ...Hi, i'm trying to solve a simple diffusion problem: the diffusion of a stagnant gas into a stagnant liquid. A code for it with the pdepe solver is li... Integrate Planck's law of radiation - comp.lang.fortran(sorry for the partial OT) In your opinion what could be the best way to integrate the Planck's law of radiation in an arbitrary interval? The pr... Grayscale Presentation State and RGB data - comp.protocols.dicom ...1) Is it legal to have a GSPS object for a US image if Photometric interpretation="RGB" and "Ultrasound Color Data Present"= 00 ( which says the pi... Power law curve fit through a specific point - comp.soft-sys ...Hi all, I have some data in matlab that I would like to fit with a power law model. The complication is that I want to force the model to pass t... sizeof nonstatic member - comp.lang.c++.moderatedSay I have a class struct A { int a1; double a2; }; I'd like to be able to write sizeof(A::a2) but it seems that is not legal. Sun CC 4.2 and 5.x (Forte) accept ... Turn off telnet/ssh login message - comp.unix.solarisAlexander Skwar <alexander@skwar.name> writes: > This product includes software subject to the license and legal > notice contained herein and which may be found at ... ERROR: Reference to vector reg 'InKbWd' is not a legal net lvalue ...ERROR: Reference to vector reg 'InKbWd' is not a legal net lvalue ... On 3/17/2011 2:52 PM, Aldorus wrote: > I am trying to implement a PS2 keyboard read ... it is that ... Statistics for Managers Using Excel by Levine 6ed Solution Manual ...... Jentz, Cross, & Miller 11 Business Law Today: Comprehensive by Miller & Jentz 8 Business Law: Principles for Today=92s Commercial Environment by Jennings & Twomey 2 ... Law - Wikipedia, the free encyclopediaLaw is a system of rules and guidelines which are enforced through social institutions to govern behavior. Laws are made by governments, specifically by their ... Boston Seafood Restaurant | Legal Harborside - Floor 2The best fine dining restaurant in Boston for seafood is Legal Harborside. The food, service, ambiance and water views are award-winning. 7/26/2012 4:12:26 PM
|