Unnecessary use of sizeof() #3
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
patate/CSS-external!3
Loading…
Reference in a new issue
No description provided.
Delete branch "master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hello,
The "size of" the data type char is always going to be one byte. The math in calculating names of players or the map doesn't need sizeof() calls, especially with a data type that is only one byte.
Multiplying numbers by one is useless.
Hey, thanks the interest you have in this project.
The use of sizeof() when allocating memory is good practice, even if sizeof(char) is always 1 on modern hardware.
The multiplication you're talking about will be evaluated at compile time, thus resulting in the exact same assembly code.
Pull request closed