InputStream assumes sizeof (int) == 4


#1

InputStream::readInt () returns int, and the documentation claims that it operates on 4 bytes. But what if sizeof (int) == 8 ?


#2

readInt should just be named readInt32 as it looks that what Jules intended


#3

Well, actually that method is one of the few bits of code that I’d trust to behave correctly if sizeof (int) was 8. According to its definition, it’d still do the right thing, even if the return value was a different type.

However, I doubt whether any compiler will ever be crazy enough to use a 64-bit int type, because it’d cause total carnage in most codebases. Certainly none of the compilers that juce supports do that, and if they ever do, I have static assertions that’ll complain about it!


#4

indeed but beware to long that differs from one platform to another