- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everybody,
I've read in Intel's website that the FINAL procedure is already supported (some kind of destructor). I've got a book with some examples of usage of such feature, but none of them work with Intel's compiler. The following example
[fortran]MODULE my_class IMPLICIT NONE PRIVATE TYPE :: c_my_class INTEGER :: test CONTAINS FINAL :: destroy END TYPE c_my_class CONTAINS SUBROUTINE destroy(self) TYPE(c_my_class) :: self PRINT *, 'This is destroy' END SUBROUTINE destroy END MODULE my_class[/fortran]won't compile, returning
error #5082: Syntax error, found '::' when expecting one of: ( % : . = =>
FINAL :: destroy
----------------------^
Any ideas? I am usingifort 11.1 20100414
Thanks in advance!
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11.1 is an old version. Current is 12.0 and the first to support FINAL. The product name is Intel Fortran Composer XE 2011.
I turned your code into a complete program to show it working. (Needed to add the PUBLIC declaration to make the type visible. Pardon my Windows.
I turned your code into a complete program to show it working. (Needed to add the PUBLIC declaration to make the type visible. Pardon my Windows.
[plain]E:Projects>type f.f90 MODULE my_class IMPLICIT NONE PRIVATE PUBLIC :: c_my_class TYPE :: c_my_class INTEGER :: test CONTAINS FINAL :: destroy END TYPE c_my_class CONTAINS SUBROUTINE destroy(self) TYPE(c_my_class) :: self PRINT *, 'This is destroy' END SUBROUTINE destroy END MODULE my_class program test use my_class call sub contains subroutine sub type(c_my_class) :: x end subroutine sub end program test E:Projects>ifort f.f90 Intel Visual Fortran Intel 64 Compiler XE for applications running on Intel 64, Version 12.0.1.127 Build 20101116 Copyright (C) 1985-2010 Intel Corporation. All rights reserved. Microsoft Incremental Linker Version 10.00.30319.01 Copyright (C) Microsoft Corporation. All rights reserved. -out:f.exe -subsystem:console f.obj E:Projects>f.exe This is destroy E:Projects>[/plain]An important note - FINAL procedures do NOT get called when a program reaches its END statement, hence the subroutine.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
FINAL should be supported in current compilers (looks like a clean compile), but not in one which was issued over a year ago.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11.1 is an old version. Current is 12.0 and the first to support FINAL. The product name is Intel Fortran Composer XE 2011.
I turned your code into a complete program to show it working. (Needed to add the PUBLIC declaration to make the type visible. Pardon my Windows.
I turned your code into a complete program to show it working. (Needed to add the PUBLIC declaration to make the type visible. Pardon my Windows.
[plain]E:Projects>type f.f90 MODULE my_class IMPLICIT NONE PRIVATE PUBLIC :: c_my_class TYPE :: c_my_class INTEGER :: test CONTAINS FINAL :: destroy END TYPE c_my_class CONTAINS SUBROUTINE destroy(self) TYPE(c_my_class) :: self PRINT *, 'This is destroy' END SUBROUTINE destroy END MODULE my_class program test use my_class call sub contains subroutine sub type(c_my_class) :: x end subroutine sub end program test E:Projects>ifort f.f90 Intel Visual Fortran Intel 64 Compiler XE for applications running on Intel 64, Version 12.0.1.127 Build 20101116 Copyright (C) 1985-2010 Intel Corporation. All rights reserved. Microsoft Incremental Linker Version 10.00.30319.01 Copyright (C) Microsoft Corporation. All rights reserved. -out:f.exe -subsystem:console f.obj E:Projects>f.exe This is destroy E:Projects>[/plain]An important note - FINAL procedures do NOT get called when a program reaches its END statement, hence the subroutine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, I was misled by my system's package manager, which claims that my ifc is up to date.
I will install it manually. Thank you very much.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page