Java type relationship or other language with processor architecture

Asked

Viewed 81 times

6

Java has the primitive types: int and float, that store at most 32 bits of information, and we also have the types long and double that store 64 bits of information.

Does this have or might have something to do with 32-bit and 64-bit processors? If I create a variable long or double to run on a 32 bit processor, may give problem?

  • No problem because a variable that occupies 64 bits of memory will be saved in two different addresses.

  • I think it’s not about the processor, even because java is a high level language. This has more to do with the amount of information the variable can store.

1 answer

5


No relation in most languages, that’s the size of the die and dot. In C, C++, Assembly (although the latter does not have formal types) and other lower level the type may have variable size according to the architecture, but there is still no direct relationship between the size of the type and the architecture, much less is it obligatory to follow this according to the specification of the language. Yet alternatively these languages also often have fixed-size types.

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

So much is true that there is long and double 32-bit. Of course in this situation there may be a slightly lower performance, but not necessarily.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.