Relation of Java types or another language with processor architecture

6

In Java you have the primitive types: int and float , which hold a maximum of 32 bits of information, and also have long and double types that hold 64 bits of information.

Does this have or could have anything to do with 32-bit and 64-bit processors? If I create a variable long or double to run on a 32-bit processor, can this be a problem?

    
asked by anonymous 01.09.2017 / 16:11

1 answer

5

No relation in most languages, ie the size of the data and point. In C, C ++, Assembly (although the latter has no formal types) and other lower level the type may have variable size according to the architecture, but there is still no direct relationship between type size and architecture, much less it is obligatory to follow this according to the specification of the language. Yet alternatively these languages also usually have fixed size types.

These bits of the architecture have to do with addressing memory rather than data, usually indicating the size of a word and in some cases a type may want to conform to the size of the word.

So much so that there is long and double in 32 bits. Of course in this situation there may be a slightly smaller performance, but not necessarily.

    
01.09.2017 / 16:18