C28138

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

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.

Example

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:

READ_PORT_UCHAR(0x80001234);  

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

READ_PORT_UCHAR(PortAddress);  

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.