|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
sparge
Joined: 11 Apr 2005 Posts: 371
|
Posted: Mon Jun 26, 2006 8:17 am Post subject: Need help interpreting this compiler warning, please! |
|
|
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:
1) 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.
2) 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)
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?
|
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7942 Location: Salford, UK
|
Posted: Mon Jun 26, 2006 10:13 am Post subject: Need help interpreting this compiler warning, please! |
|
|
Andy
The warning is relatively new and it looks like it is a false warning in this case.
The intention was to issue the warning for the following:
INTEGER i
i = 'F'
which compiles and runs but is probably not what the programmer intended.
In your code, if the values are what you expect then you can safely ignore the warning. |
|
Back to top |
|
|
sparge
Joined: 11 Apr 2005 Posts: 371
|
Posted: Tue Jun 27, 2006 2:13 am Post subject: Need help interpreting this compiler warning, please! |
|
|
That's reassuring. The only follow-up question it prompts is this: the statement in my code which generates the false warning does contain the non-standard function ccore1, to extract one character of data from a given address. All things being equal, I'd prefer not to have to use non-standard functions - but am I right in thinking that there is still no standard way in FORTRAN 95 to extract data from a given address? So in particular there is no voodoo way to do it using TRANSFER? |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7942 Location: Salford, UK
|
Posted: Tue Jun 27, 2006 5:35 am Post subject: Need help interpreting this compiler warning, please! |
|
|
Andy
Yes you are right. If there is a way then I do not know what it is. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|