KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q41578: "st" Is the Floating Point Stack Register in In-Line Assembly

Article: Q41578
Product(s): See article
Version(s): 2.00
Operating System(s): MS-DOS
Keyword(s): ENDUSER | | mspl13_c
Last Modified: 28-FEB-1989

Question:

Why can't I use the variable "st" in a block of in-line assembly code?

Response:

The "st" variable is the floating point stack register and as such is
a reserved name. If you attempt to use this name in an LES or LDS
instruction, you will receive the following error:

   error C2415 : improper operand type

You should not use "st" as a variable name. Choose another name
instead.

The following code generates error C2415 when compiled under any
memory model, at any warning level, and with MS EXTENSIONS enabled:

char * st;           /* st is the floating point stack register */
main() {
  _asm  {
      les  di, st    /* generates the error */
      lds  si, st    /* generates the error */
  }
}

Changing "st" to any other nonreserved name will resolve this
situation.

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.