Results 1 to 3 of 3
  1. #1
    Redeemer
    Join Date
    Sep 2002
    Location
    Ireland
    Posts
    1,143

    Default Problem with comments in macros

    Just noting a small (and hard to track) issue I had with precompiler macros; unless you're making heavy/advanced use of macros, you probably wont come across this issue.

    If you encapsulate multiple lines of code in a macro, including comments, it will not compile if any of the comments contain the character `, because the precompiler will incorrectly try to parse a macro within the comment.

    Example (this does not compile):
    Code:
    `define TESTMACRO(A) `A
    
    function Blah()
    {
         `TESTMACRO(// The macro `WEWT does not exist)
    }
    (this compiles):
    Code:
    `define TESTMACRO(A) `A
    
    function Blah()
    {
         `TESTMACRO(// The macro WEWT does not exist)
    }
    The only difference between the two, is a ` within the commented text.


    The code I was originally working with, which caused this issue (deliberately missing a lot of context, as the only relevant line is the comment):
    Code:
    `SET_PROPACCESS(GetObjAddress(SourceObj) + SourcePropertyObj.Offset, OrigAccessAddress,
    	`SET_UPROP_OFFSET(default.PropArrayRef, 0, OrigPropOffset,
    		SourceSize = default.PropAccess.ArrayRef.ArrayNum;
    	)
    
    	// Skips using `SET_PROPACCESS as it should not be used recursively
    	default.DefaultObj.PropAccessAddress = GetObjAddress(DestObj) + DestPropertyObj.Offset;
    
    	`SET_UPROP_OFFSET(default.PropArrayRef, 0, OrigPropOffset,
    		DestSize = default.PropAccess.ArrayRef.ArrayNum;
    	)
    )

  2. #2
    MSgt. Shooter Person
    Join Date
    Apr 2006
    Location
    Raleigh, NC
    Posts
    278

    Default

    Thanks for the report. We see the same thing here and we'll get it fixed as quickly as priorities allow.

  3. #3
    Redeemer
    Join Date
    Sep 2002
    Location
    Ireland
    Posts
    1,143

    Default

    Cheers
    Also worth noting is that the , character causes the same problem, and possibly others too, so worth testing a wide range of unusual characters.


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.