Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch-case broken when handling -2147483648 #1024

Open
Localia-cn opened this issue Feb 21, 2025 · 0 comments
Open

switch-case broken when handling -2147483648 #1024

Localia-cn opened this issue Feb 21, 2025 · 0 comments

Comments

@Localia-cn
Copy link

When a case label is set to -2147483648, it causes other case branches to erroneously fall through to the default branch.
SM version : 1.13.0.7213
System: win10
Game: Left 4 Dead 2

public void OnPluginStart()
{

	func(-1);			  // case: default
	func(0);			  // case: default
	func(1);			  // case: default
	func(2);			  // case: default
	func(3);			  // case: default
	func(-2147483648);	  // case: -2147483648

}

void func(int a1)
{
	switch (a1)
	{
		case -1:
		{
			PrintToServer("case: -1");
		}
		case 0:
		{
			PrintToServer("case: 0");
		}
		case 1:
		{
			PrintToServer("case: 1");
		}
		case 2:
		{
			PrintToServer("case: 2");
		}
		case 3:
		{
			PrintToServer("case: 3");
		}
		case (-2147483648):
		{
			PrintToServer("case: -2147483648");
		}
	

		default:
		{
			PrintToServer("case: default");
		}
	}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant