What is the difference between a word and a short?

1.1k Views Asked by At

I've tried doing my due diligence here, and I'm not sure if the systems register affects how big a word can be? but from a quick google, it seems that the definitive answer is that a word is 2 bytes(16 bits?) of data. To my knowledge, a short is also 16 bits of data.

Is the difference literally that a word is 2 bytes and a short is 16 bits (00000000 00000000 vs 0000000000000000), why do we have two types of data for the same(well at least extremely similar) datatype?

Is the difference more nuanced, like an OS level thing, similar to why Microsoft names their bool's BOOL, etc.?

Any light shed is appreciated thanks :) even better is reference material, since its really hard to google these topics without getting short stories as my search results grumble.

yes haha WORD and DWORD are the types I'm referring to, and were working on an embedded controller running WINCE13.

1

There are 1 best solutions below

4
Marcus Müller On

it seems that the definitive answer is that a word is 2 bytes(16 bits?) of data.

whatever you googled, that's wrong.

"Word" is a bit of a contextual term, but in the context of data type sizes, it usually refers to the default size of integer registers, or that of a pointer.

So, on the machine you've wrote that question on, it's probably 32 bit, maybe 64 bit, depending on who you ask. Certainly not 2 byte like short.

On an 8bit microcontroller, it'd be 8 bit. On 16 bit machine, a machine word would be 16bit.

All in all, word is very ambiguous a term, and anybody who actually wants to specify a length will use a specifier like "in this SSE register, we group four 32 bit words to a 128 bit word".


with your late information:

yes haha WORD and DWORD are the types I'm referring to, and were working on an embedded controller running WINCE13.

Then that's well-documented in the context of windows development. WORD is not the same as "a word", but a specific, microsoft-invented typedef, which might actually have a specific length.

Hint: Microsoft has stopped maintaining WindowsCE, and even the long-term paid support ends October 2023. Please migrate to a different platform, should you not wish to build an obsolete system from the start. You must especially never connect such a system to the internet – Microsoft will not provide further security updates.