Is it a bug ?

Sang Chunlei sangchunlei@hotmail.com
Thu Jan 27 09:05:00 GMT 2005


fun_ptr should return the value of ptr, but it return the address ?known 
bug ?
 
 
 
program ptr
  interface
     function fun_ptr(m1,m2)result(ptr)
       integer,intent(in)::m1,m2
       integer,pointer::ptr
     end function fun_ptr
  end interface
 
  integer::x, y
  integer,target::rm
 
!  read*, x, y                                                              
                        
  rm=fun_ptr(4,5)
  print*,rm
end program ptr
 
function fun_ptr(m1,m2)result(ptr)
  integer,intent(in)::m1,m2
  integer,pointer::ptr
  allocate(ptr)
 
  if(m1<m2) then
     ptr=m1
  else
     ptr=m2
  end if
end function fun_ptr

_________________________________________________________________
ÏíÓÃÊÀ½çÉÏ×î´óµÄµç×ÓÓʼþϵͳ¡ª MSN Hotmail¡£  http://www.hotmail.com  



More information about the Fortran mailing list