[Fixed] Constants can be passed to "out" arguments, causes crashes

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Constants can be passed to "out" arguments, causes crashes

Postby phantombeta » Mon Oct 21, 2019 8:55 am

You can pass constant values to "out" arguments. Once the function call happens, this causes a crash. (Both with the VM and the JIT)
Passing a constant to an out parameter should error out. Mostly putting this here so I don't forget it.

Example code:
Code: Select allExpand view
class BEPlayerBase : DoomPlayer
{
   private void CheckCursorMovement(out int maxWidth, int maxHeight)
   {
      Console.Printf ("%d", maxWidth);
   }

   vector2 SomeGridCoords;

   override void Tick()
   {
      int buttons = player.original_cmd.buttons;
      int oldbuttons = player.original_oldbuttons;

      if (buttons & BT_ATTACK)
      {
         CheckCursorMovement(5, 5);
      }

      Super.Tick();
   }
}
User avatar
phantombeta
In the meadow of sinful thoughts, every flower's a perfect one
 
Joined: 02 May 2013
Location: The United Soviet Socialist Dictatorship of Hueland
Discord: phantombeta#2461
Twitch ID: phantombeta_
Github ID: Doom2fan
Operating System: Windows 10/8.1/8 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support



Return to Closed Bugs

Who is online

Users browsing this forum: Awario [RSS], DotBot, Trendiction.de [Bot] and 0 guests