4 ms·
this version of c-- does not address some of the bloat and shortcomings of the C syntax: should have no integer promotion, no implicit casts (except for litera
by sylware 4y ago
this version of c-- does not address some of the bloat and shortcomings of the C syntax:
should have no integer promotion, no implicit casts (except for literals like rust? and void* ofc namely), have runtime/compile-time casts, idem for "constants", no horrible typedef/enum/_generic/etc, only sized type (my heart is split between uw/u16,sdw s32, etc), variable arguments of preprocessor macros definitively defined, only one loop statement loop{}, no switch...
- krylon 4y agoIt's not really meant as a competitor to C, and AFAIU, it's meant as a target for a compiler front/middle end, not as a language to write code in manually. Unless you're hacking GHC itself, you're rather unlikely to touch it.
- downvotetruth 4y agoC does not have implicit casts
- chlorion 4y agoC most certainly does have implicit casts, and they are everywhere. Simple example: // malloc returns *void, but C casts it to *char char *p = malloc(10); There are tons of implicit casts when working with integers of different sizes, another example: // subtraction of ints of different signedness // C casts signed int 10 to an unsigned int assert(2U - 10 == 4294967288); Arrays decay into pointers which is another implicit cast, I don't think an example is needed though. Anyways these are just a few common examples, there are tons more and many of them are pretty subtle and error prone. https://en.cppreference.com/w/c/language/conversion https://en.cppreference.com/w/c/language/conversion
- deleted 4y ago[deleted]