449
To type or not to type ?
(sh.itjust.works)
Post funny things about programming here! (Or just rant about your favourite programming language.)
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.