Skip to content

"Always true" comparison #83

Closed
Closed
@mattgodbolt

Description

@mattgodbolt

With warnings on, gcc will complain that:

assert(lock_num >= 0 && lock_num < NUM_SPIN_LOCKS);

error: comparison of unsigned expression >= 0 is always true [-Werror=type-limits]
   25 |     assert(lock_num >= 0 && lock_num < NUM_SPIN_LOCKS);

which is indeed true. Perhaps a little picky, but by definition the unsigned parameter lock_num is >= 0.

Ditto in lock_core.c:10

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions