Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Fortran's analog to "void*" ?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Dick Hendrickson  
View profile  
 More options Oct 27 2012, 12:27 pm
Newsgroups: comp.lang.fortran
From: Dick Hendrickson <dick.hendrick...@att.net>
Date: Sat, 27 Oct 2012 11:27:15 -0500
Local: Sat, Oct 27 2012 12:27 pm
Subject: Re: Fortran's analog to "void*" ?
On 10/27/12 3:34 AM, john.chludzin...@gmail.com wrote:
> If want a subroutine to have a dummy argument that is a "void" pointer and within the subroutine cast it as a pointer to something specific, how is this best accomplished?

> ---John

Maybe I'm misunderstand this (you're using way too many C terms for me
;) ).  But I think something like this is what you (should?) want

      pointer  ::  xx, yy
      nullify (xx)
or
      yy => null()

Will set the association status of xx and yy to disassociated.

Then
      call sub (xx)
or
      call sub (yy)

to
      subroutine sub (zz)
      pointer  ::  zz

      if (.not. associated(zz))  zz => whatever

I think the NULL() function and the NULLIFY statement more or less
correspond to setting a pointer to the C void status.  The ASSOCIATED()
function lets you check for "void".  As others ahve said, if you really
want to interoperate the pointers with C, it's harder.  But, your
earlier questions have been oriented to translating C to Fortran.

Dick Hendrickson


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.