- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
While MIN can take several arguments MIN(A,B,C), why not permit the elemental intrinsic bit manipulation functions take more than two variables: IOR(I,J,K), same with the other bit manipulation functions.
(I expect "it's not done")
Jim Dempsey
Link Copied
- « Previous
-
- 1
- 2
- Next »
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
.XOR. is a logical operator not to be confused with an intrinsic function IEOR, IXOR, IPARITY (though I wish IPARITY would accept a list of variables in addition to an array of variables).
In the documentation Summary of Operator Precedence it lists defined binary operators as having lowest priority (less than .XOR.). It does not state that this is affected by the /standard-semantics switch.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The precedence of defined operators doesn't change with /standard-semantics. What does change is whether or not .xor. is recognized as a predefined operator. Without /standard-semantics, if you have a user-defined operator .xor. that supercedes the predefined one.
The situation where this can make a difference is if you overload .xor. with a signature different from the intrinsic.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This program prints '/standard-semantics is in effect.' on gfortran, and 'Non-standard precedence detected.' on ifort without the /standard-semantics switch in effect. What does it print with that switch enabled?
[fortran]
module m
implicit none
private
public operator(.MyOp.), operator(.XOR.)
interface operator(.MyOp.)
module procedure p1
end interface operator(.MyOp.)
interface operator(.XOR.)
module procedure p2
end interface operator(.XOR.)
contains
function p1(x,y)
integer p1
integer, intent(in) :: x, y
p1 = 0
end function p1
function p2(x,y)
integer p2
integer, intent(in) :: x, y
p2 = 1
end function p2
end module m
program p
use m
implicit none
if((0 .MyOp. 0 .XOR. 0) == 1) then
print '(a)', '/standard-semantics is in effect.'
else
print '(a)', 'Non-standard precedence detected.'
end if
end program p
[/fortran]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[plain]
C:\Projects\Q697475\Console3>ifort /standard-semantics ro.f90
Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 13.1.3.198 Build 20130607
Copyright (C) 1985-2013 Intel Corporation. All rights reserved.
Microsoft (R) Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation. All rights reserved.
-out:ro.exe
-subsystem:console
ro.obj
C:\Projects\Q697475\Console3>ro.exe
/standard-semantics is in effect.
[/plain]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve,
I am a little bit confused with respect to /standard-sematics and non-standard semantics as it applies to Repeat Offenders post.
In his post, he has overloaded operator .XOR.
Your reply seems to indicate that depending on /standard-sematics or lack thereof that the compiler will (silently) use either the user specified overloaded .XOR. or the internal (intrinsic) .XOR.
On the other hand you could have ment the /standard-sematics or lack thereof only affecte the precidence, and in both cases the user specified overloaded .XOR. is used.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Without /standard-semantics, one can overload (extend the generic) .xor. but you get the compiler's non-standard precedence for it. With /standard-semantics, the compiler doesn't provide .xor. so RO's definition is the only one.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"Additional intrinsic functions for bit manipulation [mostly 5.3]" The array reduction intrinsic functions IALL, IANY and IPARITY appear to be Fortran 2008 additions, perahsp that is why we are not so familliar....

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- « Previous
-
- 1
- 2
- Next »