Conversation

The real original sin of C isn't NULL, or void*, or array indexing, or strcat...

It's signed integers.

2
2
0

BRB designing a C-variant where all integers are unsigned

6
1
0
@foone could not agree more. also when doing API/ABI it is good to use explicit size types so that the binary interface stays constant for 32-bit and 64-bit builds. Makes debugging experience so much more lean.
0
0
3

@foone You should do this. It would be nice.

0
0
0

@foone will I be able to buy a dev cert to sign my integers?

1
0
0

@esther_alter of course. floats are even worse!

0
0
0

@foone A decent number of my compiler errors were search and replacing "singed" for "signed".

1
0
0

@growf don't let your numbers get too close to the fire! you'll get singed integers!

0
0
0

@foone those are the natural numbers then, not integers.

Proposal: in their 64 bit incarnation you call them big naturals

1
0
0

@wotsac so instead of int and bigint, they can be nat and bignat!

0
0
0

@0xdd @foone That can’t be the original sin of C because originally C had 16-bit int by default.

0
0
0

@0xdd @foone
that's not the default, on 16bit architectures int was 16 bit - it's just that for most 64bit architectures (I think in the early days there were outliers?) int was kept at 32bits instead of making it the native word size again.

I personally would prefer if short were *always* 16bit, int 32bit, long 64bit, but that's something one can do in a new programming language (D does it), for C with its loong history that's not possible

2
0
0

@Doomed_Daniel @foone @jrose yeah, the longer non-quip version is something like there should be native data types for specific sizes and some extras that are per CPU like native register width, etc.

make uintX_t etc the default, make char 8 bits because utf8, and yeet short, int, long, etc

1
0
0

@0xdd @foone @jrose
I think my biggest annoyance with int and long not being the same size everywhere is when using printf() and the like (and no, I don't think that sticking PRi32 etc in between your format string parts makes it more usable/readable)

2
0
0

@Doomed_Daniel Yeah, I settled on “always cast to the bigger type if it really matters” :-/

1
0
0

@Doomed_Daniel yeah, i always forget that with size_t. must be a real pita for cross platform stuff

1
0
0

@0xdd long being 32bit on Win64 is especially annoying for crossplatform stuff.
For size_t you at least can use %zu (or %zx or whatever)

0
0
0