r/transprogrammer • • Jul 16 '24

Javascript bad

Post image
104 Upvotes

35 comments sorted by

View all comments

Show parent comment

1

u/natalialt Jul 17 '24

In which case yeah, I wouldn't be surprised if this was a case of network protocols being big endian (stuff like TCP/IP packets) and JS following that lol. Fun fact, typed arrays (Uint32Array et al) use the system's native endianness instead of defaulting to anything

1

u/definitelynotagirl99 Jul 17 '24

well i mean, it doesn't really matter what endianness is used by typed arrays as you're never gonna read their internal buffer, that said tho, i am happy to see that those that designed typed arrays didn't make a terrible and illogical design choice

1

u/definitelynotagirl99 Jul 17 '24

as for the network endianness thing, it's still complete bs to have anything at all ever be big endian nowadays since pretty much all hardware computes in little endian and as such needs to waste at minimum 1 CPU cycle swapping the bytes

edit: typo