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

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
phantombeta
Posts: 2084
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

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

Post by phantombeta »

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 all

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();
	}
}
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Constants can be passed to "out" arguments, causes crash

Post by _mental_ »

Post Reply

Return to “Closed Bugs [GZDoom]”