C++ Data models

A usual headache to C++ beginners: What is the value of sizeof(int) in C/C++?

The answer is: there is no specific answer.

In theory, the C++ standard does not define explicitly the size of primitive data types but it does define their minimum size. You can read more about it at official C++ reference page

In practice though, there are 4 data models that are mostly used : LP32, ILP32, LLP64 and LP64. Both Windows and Linux 32 architectures use ILP32. Windows 64bit use LP64 and Linux 64bit use LLP 64.

If you compare the values, you will see that sizes of all floating point data types are the same regardless of architecture (float 4, double 8, long double 16) and all integer data types are the same apart from long (char 1, short 2, int 4, long long 8). Of course pointers depend on the architecture (32bit in x86 and 64 bit in AMD64)

Here is a handy table for you.




Doom 3 in modern computers

In this post I explained in summary what you have to do to run Doom 1 & 2 in your modern PC. Doom 3 is a totally different story.

The reason is that ID released two games named Doom 3 which are considered totaly different by hardcore gamers:

  1. Doom3 (vanilla version). This version was released on 2004 and it is considered an old game. Doom3 vanilla version was designed as a thriller.
  2. Doom3 BFG, released on 2012. Doom 3 BFG was designed as a shoot em up.
Continue reading Doom 3 in modern computers