Remix.run Logo
tremon an hour ago

> Processors have a very weak notion of data types

This is absolutely not true, unless you mean to say that processors should somehow support composite (aka C struct) data types as an instruction primitive. Processor operations have to be strongly typed, by definition. For example, these are the data types supported by operations in the modern x86 instruction set (ignoring vector extensions):

- signed and unsigned integers of 8, 16, 32 and 64 bits

- floating-point decimals of 32, 64 and 80 bits (and 128 via sse)

- nul-terminated byte strings

> For example: casting a `float` to an `int` has a very specific definition in C, and that definition involves altering the pattern of bits

I don't understand this example. Casting a float to an int also has a very specific definition in IEEE-754 and is pretty much universally implemented as a hardware instruction. It has been in the x86 family since its inception: https://www.felixcloutier.com/x86/fisttp

Pannoniae an hour ago | parent [-]

I wholly agree, processors are strongly typed, even if there are holes like using integer instructions on floating-point values in XMM regs, very insightful comment:)

btw a bit of nitpick: to be fair basically no one uses x87 anymore, it's https://www.felixcloutier.com/x86/cvttss2si and friends but yes :)

uecker 44 minutes ago | parent [-]

For "strongly typed" I would expect some type checking.