Skip to content

Checks for uninitialized data could use some work #153

@RobbyCBennett

Description

@RobbyCBennett

The following is a simplification of an actual bug I found in my keyboard remapper code.

// (struct defined in system header)
typedef struct {
  int x;
  int y;
} Event;

void f(Event *events);

int main()
{
  #define EVENTS 2
  Event events[EVENTS];

  for (int i = 0; i < EVENTS; i++)
    f(events + i);
}

I don't see a warning in the user part of the code from any of the uninitialized data checks. The only one that kinda works is CPP_DD022 (made by @jasonbquinn) because it works in C but not in C++. This is the best uninitialized data check, but it could still be improved to work in C++.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions