Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Collapse the table of content
Expand the table of content


warning C28138: The constant argument should instead be variable

This warning is reported in a function call that expects a variable or a non-constant expression, but the call includes a constant. For information about the function and its parameter, consult the WDK documentation of the function.

For example, in the following code example, the parameter of the READ_PORT_UCHAR macro must be a pointer to the port address, not the address provided as a constant.

The following code example generates this warning message:


To correct this warning, use a pointer to the port address.


There are a few older devices for which a constant parameter is acceptable with the READ_PORT and WRITE_PORT family of functions. When those devices receive this warning, the warning can be suppressed or ignored. However, any new devices should not assume a constant hardware address.

© 2015 Microsoft