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:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] lowleveldata@programming.dev 12 points 1 year ago (12 children)

tbh unsigned int scares me too. I just use int anyway to avoid strange things happening.

[–] bioemerl@kbin.social 1 points 1 year ago (5 children)

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.

[–] Anomandaris@kbin.social 11 points 1 year ago* (last edited 1 year ago)

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.

load more comments (4 replies)
load more comments (10 replies)