This is the separate post referred to in the post about 'mixed' projects ...
When I compiled my code using Checkmate, just to reassure myself that the array overrun would indeed have been caught, at runtime if not at compile time, the compiler threw up this warning which generated a nasty sinking feeling in my innards:
'warning 362 - Assigning a value of type CHARACTER(LEN=1) to a variable of type INTEGER(KIND=3) is a non-standard extension, use the TRANSFER intrinsic'
The sinking feeling is for three reasons:
- The line in question is deep inside the core of my code, and I had not been aware there was an issue with it until now.
- I can't understand the warning: I can't see an assignment of a value of type character (len=1) to a variable of type integer (kind=3)
- From my perspective, the TRANSFER intrinsic is not far removed from black magic. I've managed without it so far, and I would have been happier to keep things that way 😦
The line in question and the declarations that relate to it are:
type rgbint
integer redint
integer greint
integer bluint
end type rgbint
type (rgbint) ... pixsin
integer ... ptrs, ...
pixsin = rgbint (ichar (ccore1 (ptrs + 2)), ichar (ccore1 (ptrs + 1)), ichar (ccore1 (ptrs)))
Now then.
- ccore1 returns a single character from an integer (kind=3) memory location. I know it's an extension;
- ichar converts a character to an integer, of default type
So where is a value of type character (len=1) being assigned to a variable of type integer (kind=3)? And how would I achieve what this non-standard statement does using the standard intrinsic TRANSFER?