KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q137174: DOCERR: A2041 Error When Macro Parameter Length > 255 bytes

Article: Q137174
Product(s): Microsoft Macro Assembler
Version(s): 6.11
Operating System(s): 
Keyword(s): 
Last Modified: 04-MAY-2001

-------------------------------------------------------------------------------
The information in this article applies to:

- Microsoft Macro Assembler (MASM), version 6.11 
-------------------------------------------------------------------------------

SUMMARY
=======

MASM returns an A2041 error (String or Text literal too long) when passing to a
MACRO a set of parameters whose total length is greater than 255 bytes. The
inidvidual parameters may be shorter than the stated 255 byte maximum, but the
MACRO expansion treats the entire parameter list as a single string (text
literal).

MORE INFORMATION
================

This behavior is by design, though it is not currently documented as such. The
following code demonstrates this behavior:

     .486
     .486
     .MODEL FLAT
     .CODE

     menu_list    macro   item1,item2,item3,item4,item5,item6,item7
                  endm

          menu_list       <'ACTION1','ACTION1','ACTION1','ACTION1'>,\ 
                          <'ACTION2','ACTION2','ACTION2','ACTION2'>,\ 
                          <'ACTION3','ACTION3','ACTION3','ACTION3'>,\ 
                          <'ACTION4','ACTION4','ACTION4','ACTION4'>,\ 
                          <'ACTION5','ACTION5','ACTION5','ACTION5'>,\ 
                          <'ACTION6','ACTION6','ACTION6','ACTION6'>,\ 
                          <'ACTION7','ACTION7','ACTION7','ACTION7'>
          end

This is the message MASM returns upon compiling this sample:

  Microsoft (R) Macro Assembler Version 6.11 Copyright (C) Microsoft Corp
  1981-1994. All rights reserved.

  Assembling: test.asm test.asm(9) : error A2041: string or text literal too
  long

Additional query words: 6.11

======================================================================
Keywords          :  
Technology        : kbMASMsearch kbAudDeveloper kbMASM611
Version           : :6.11

=============================================================================

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.