Skip to content

Size of enum is shown wrongly in Intellisense #85

@Shulcare

Description

@Shulcare

Describe the bug:
When defining enums with values that can fit into a char or short, sizeof() of this enum typedef always shows 4 on mouser hover. This is also reflected in sizeof structs that use these enums which get much bigger than they should.
I've tried to find any Intellisense configuration to change this, but did not find anything.

To Reproduce:
Define an enum typedef with max value <= 0xFF. Write sizeof() and hover on it.

Expected behavior:
Sizeof enum should match the actual size from the compiler, which in case of IAR is always the smallest possible type to fit all values. So it should show 1 or 2 for smaller enums.

Actual behavior:
Size of enum types is always 4, no matter how small they are.

Environment:

  • OS: Windows 11
  • Embedded Workbench: Arm
  • Embedded Workbench version: 9.40.1
  • VSC Extension version: 1.30.6

Additional context:
There are no flags set in our IAR project that would change the enum sizes from their default, and the ELF output definitely has the smaller enum sizes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions