forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need help interpreting this compiler warning, please!

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
sparge



Joined: 11 Apr 2005
Posts: 371

PostPosted: Mon Jun 26, 2006 8:17 am    Post subject: Need help interpreting this compiler warning, please! Reply with quote

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 Sad

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
View user's profile Send private message Send e-mail
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7925
Location: Salford, UK

PostPosted: Mon Jun 26, 2006 10:13 am    Post subject: Need help interpreting this compiler warning, please! Reply with quote

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
View user's profile Send private message AIM Address
sparge



Joined: 11 Apr 2005
Posts: 371

PostPosted: Tue Jun 27, 2006 2:13 am    Post subject: Need help interpreting this compiler warning, please! Reply with quote

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
View user's profile Send private message Send e-mail
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7925
Location: Salford, UK

PostPosted: Tue Jun 27, 2006 5:35 am    Post subject: Need help interpreting this compiler warning, please! Reply with quote

Andy

Yes you are right. If there is a way then I do not know what it is.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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