To type or not to type ?
To type or not to type ?
To type or not to type ?
tbh c/c++ type system is super fucked up
What the fuck is unsigned long long int
just call it u64
Well it isn't always 64 bytes. Some architectures differ.
usize
then
you can just use unsigned long long
(drop the int) or, if it bothers you that much, uint64t
but keep in mind that yhe size of unsigned long long
may vary depending on the architecture
const a: any = "You have no power here!"
laughs in reinterpret_cast
Is it even a programming language if you can't casually introduce type overflows?
tbh unsigned int scares me too. I just use int anyway to avoid strange things happening.
The use of it quite limited in the every-day coders life. People acting like they be using 500TB databases these days.
Embedded software devs still exist btw
I use uints every day at work. They’re very useful for cases when you’ve only got a single byte or two bytes to work with. E.g. an 8-bit int will only get you to a max of 127, but of course an unsigned 8-bit gets you to 255. Similar concept with 16/32/64s. Very useful when you’re working with small amounts of available memory, such as when writing code to go on ASICs.
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.
why not just compile with overflow checking? assuming the number should not reach the limits
typescript is still weakly typed.
it is just a hacky static analysis that compiles to weakly typed js
Solution:
export type unsigned_int = number
export type App = unknown