- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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.
링크가 복사됨
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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.
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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.
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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!
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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.
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
And the example goes back further than that - it came from the Microsoft Fortran PowerStation reference, with the same errors.
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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 :-)
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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).
