this post was submitted on 13 Jul 2023
454 points (98.3% liked)
Programmer Humor
32031 readers
1674 users here now
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
- Posts must be relevant to programming, programmers, or computer science.
- No NSFW content.
- Jokes must be in good taste. No hate speech, bigotry, etc.
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
tbh unsigned int scares me too. I just use int anyway to avoid strange things happening.
Yep, I always default to the largest possible type because compute is less valuable than my time on the weekend and the potential for any sort of overflow.
Long
Double
Big int
Etc.
I don't know if I'd go that far. If you're talking about a quick script then sure, whatever gets the job done. But for any actual project the use of good, consistent typing does a lot for readability and future-proofing. And in strongly-typed languages it can have a notable affect on the overall functionality too.
If you can't tell from context whether something is a float or if it'll overflow the int max then you probably need to re-think the entire method.