- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
The documentation for the non-standard LOC() function in the IFort 15 manual at https://software.intel.com/en-us/compiler_15.0_ug_f contains example code containing Cray pointers, and readers who may have never heard of Cray pointers may find the code confusing. Perhaps the adjective 'Cray' can be added to the word 'pointer' in the comments in the code to obviate this confusion.
- Marcas:
- Intel® Fortran Compiler
Link copiado
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Well, we don't call them Cray pointers - we call them "integer pointers". Cray doesn't want you to call them Cray pointers either, but accept that everyone does. I will suggest an edit to this text.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Wow - that example has a LOT more wrong than just what we call the pointer. Neither the Fortran code nor the C code would even compile, and the example itself is ridiculous. I will come up with something better.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
The buggy example code (square brackets for Fortran dimensions; setting an integer equal to a float array in the C function; the non-use of the array VAR associated with the integer pointer; expecting the local array a[] in the C function to remain allocated after leaving the C function) is the same as it was in the CVF 6 reference manual!
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Not surprising.... We have a project underway to take all of the manual examples and put them in a test suite. You didn't mention that the example works only for 32-bit.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
And the example goes back further than that - it came from the Microsoft Fortran PowerStation reference, with the same errors.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Steve Lionel (Intel) wrote:
And the example goes back further than that - it came from the Microsoft Fortran PowerStation reference, with the same errors.
I binned a box of stuff last year and one of the contents was the Powerstation 1.0 manual. I almost wish I had kept it to have a laugh now and again. Actually Powerstation was a big plus when it came our as it gave access to extended memory :-)
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
I have asked that the example be replaced with this:
! Example of using the LOC intrinsic integer :: array(2) = [10,20] integer :: t pointer (p,t) ! Integer pointer extension ! p is pointer, t is pointee (target) ! This declares p as an address-sized integer p = loc(array(1)) ! Address of array(1) print *, t ! Prints 10 p = loc(array(2)) ! Address of array(2) print *, t ! Prints 20
I also suggested adding text recommending use of the ISO_C_BINDING functions instead, though those are not a direct replacement for LOC (and integer pointers).

- Subscrever fonte RSS
- Marcar tópico como novo
- Marcar tópico como lido
- Flutuar este Tópico para o utilizador atual
- Marcador
- Subscrever
- Página amigável para impressora