Warning when passing hexadecimal constants to a QWIN function

Warning when passing hexadecimal constants to a QWIN function

I get a warning message when I pass a hexadecimal number to a QWIN function:

call setlinestyle(#FFFF)

I tried the alternative syntax (Z'FFFF') but get the same warning:

D:sfpintel9ds_phiaxisparm.for(108) : Warning: The data type of the actual argument does not match the definition. [Z'FFFF']
call setlinestyle(Z'FFFF')
----------------------------^

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

This issue is mentioned in the 9.0 release notes - the compiler used to be quiet about a mismatch between the argument type and what was declared in the interface, but now it properly complains. This does pose a problem for hex constants as you can't specify the integer "kind" and values such as #FFFF are out of range for the INT function.

Two options I can suggest:

1. Declare a PARAMETER constant of the correct kind, such as:

INTEGER(2), PARAMETER : Z_FFFF = Z'FFFF'

and use that in the call.

2. Use the TRANSFER intrinsic such as:

call setlinestyle(TRANSFER(Z'FFFF',0_2))

We recognize that this causes problems for some users and are thinking about ways to mitigate it.

Steve

No problem, I'll do that. However, I'm not sure what you mean by "values such as #FFFF are out of range for the INT function" - this is two bytes, just what integer*2 requires? How is defining it via a parameter any different?

Incidentally I get a similar warning when I pass an expression as the argument, as in:
call setlinestyle(14+12*(i-1))

(not sure of the exact expression as I'm at home now - will check at work Thursday)

Adrian

The argument to setlinestyle is INTEGER(2). The value #FFFF is INTEGER(4), and would overflow if converted to the signed INTEGER(2) datatype.

Similarly, your expression is INTEGER(4), which does not match the INTEGER(2) type of the argument.

Steve

Login to leave a comment.