Skip to content

enum increments (*=1) and (<<=0) work as (+=1) #540

@Daniel-Cortez

Description

@Daniel-Cortez

Issue description:

enum (*= 1)
{
	EnumItem1 = 1,
	EnumItem2,
	EnumItem3,
	EnumItem4,
};

main()
{
	printf("EnumItem1: %d", EnumItem1);
	printf("EnumItem2: %d", EnumItem2);
	printf("EnumItem3: %d", EnumItem3);
	printf("EnumItem4: %d", EnumItem4);
}

Normally all enumeration elements in this example should be equal to 1, but when executing this code, it prints the following:

EnumItem1: 1
EnumItem2: 2
EnumItem3: 3
EnumItem4: 4

The same happens if increment *= 1 is replaced with <<= 0 - it's as if no increment was specified at all, so the default increment (+= 1) takes place.

Minimal complete verifiable example (MCVE):

See above.

Workspace Information:

  • Compiler version: 3.10.10, 3.2.3664
  • Command line arguments provided (or sampctl version):
  • Operating System:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions