3 ms·
> 1? Did you mean an int? 1 > Float? 1.0f > Double? 1.0 > 8 bits? 16? Those would actually need the type. > 32? 1 > 64? 1ll > signed? 1 > unsigned
by viraptor 17y ago
> 1? Did you mean an int?
1
> Float?
1.0f
> Double?
1.0
> 8 bits? 16?
Those would actually need the type.
> 32?
1
> 64?
1ll
> signed?
1
> unsigned?
1u
C copiler already does that "inference" when you pass an attribute into a function - so why not when you declare the variable?
- tumult 17y agobecause you can write to a variable or pass it to more than one function
- viraptor 17y agoSo you can infer the type on the first usage only and then treat the variable like it has a static type (because it does). That's what most type-inferring, static languages do.
- tumult 17y agothe really smart, immutable ones, could let you treat the expression as any of those types as you like. this is supposed to be a cleaner C syntax, not another platform.