Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
3 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20545a2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tbh I don't like these kinds of fixes. IMHO if there is a need for a cast there is something wrong. Why does the assignment of tablesArray have to be cast? I'll have to look at the code. But casting feels like duct taping to me, just making a possibly real problem disappear out of sight.
20545a2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Davy just added an explicit cast where I assume on *nix an implicit cast happens. It is needed because List and the list_* functions are generic. Don't know, maybe this is bad coding style. I've seen it done somewhere else, and I don't know how you could otherwise make something generic.
20545a2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, maybe I'll have to read up in my copy of 21st Century C
20545a2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Don't know if it says anything about it :)
20545a2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me, explicitly casting makes clear the intention: use a generic function with an instantiated array of chars. I guess the generics aren't as clean as in an object oriented language, but I have also seen it done before. I also like a clean build log so real problems will catch my attention a bit quicker.
The much more ugly casts, and IMO a real problem are the casts from size_t to int, where int can have different sizes on different platforms (and maybe size_t can too). But we should be 'safe' here since none of these strings should ever reach a length that won't fit in even 16 bits. I considered actually using variables of type size_t, but this cascades down the code and gets all over the place.