0

I'm confused about the term word in solidity. When I google word, it says 1 word = 2 bytes but whenever I read word mentioned in the context of solidity, it sounds like 1 word = 32 bytes?

What is a word in solidity then? Why does it seem like 1 word in solidity is 32 bytes but only 4 bytes in other places?

xenon
  • 455
  • 4
  • 14
  • A word in Ethereum (not just Solidity) is 32 bytes, or 256 bits. – Paul Razvan Berg Jul 05 '22 at 08:40
  • @PaulRazvanBerg Thanks, is 1 word = 32 bytes = 256 bits something specific to only Ethereum and Solidity? That means, in Solidity, it uses a 256-bit word. But in a different system or VM like Java, it uses 32-bit word. Hence, the term word here is different with different systems, is my understanding correct? – xenon Jul 05 '22 at 08:51
  • I guess so. I am not familiar with the JVM. You might want to re-articulate your question and post it on the Software Engineering StackExchange website. – Paul Razvan Berg Jul 05 '22 at 09:36
  • @PaulRazvanBerg Oh JVM is just a random example here. What I was trying to understand is that different systems will have different number of bytes for a word, right? And in the case of EVM, it just designed such that 1 word is 32 bytes. Is that right? – xenon Jul 05 '22 at 09:40
  • I don't know for sure. And this isn't a specific question about Ethereum - that is why I redirected you to the SE StackExchange. – Paul Razvan Berg Jul 05 '22 at 09:58
  • 1
    @xenon - Yes, I'd say the assertion in your final message is correct. (https://en.wikipedia.org/wiki/Word_(computer_architecture)#Table_of_word_sizes) – Richard Horrocks Jul 05 '22 at 15:08
  • Thanks guys for clarifying my doubts! :) – xenon Jul 11 '22 at 14:48

0 Answers0