449
To type or not to type ? (sh.itjust.works)
you are viewing a single comment's thread
view the rest of the comments
[-] lowleveldata@programming.dev 12 points 1 year ago

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

[-] bioemerl@kbin.social 1 points 1 year ago

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)
this post was submitted on 13 Jul 2023
449 points (98.3% liked)

Programmer Humor

32453 readers
673 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS