Yes, using smaller types will typically reduce the memory; however, it highly depends.
Take the stack, for example. Everything on the stack is actually the native size of the CPU. So, if you just have a char in a function, you really didn't save any memory at all.
Compilers will typically add padding to structures as well, to promote the size of the struct to a multiple of the CPU bit size. They usually do this, since it'll allow the data to be copied in far less cycles then a non-aligned struct.
I personally like to just use the standard types (char, short, int, long, ect...), since I typically find that it doesn't really matter. As long as you can guarantee that the type you choose can hold the values you need, you are fine.
One of the common things I see in open source projects, that I hate, is the use of specific type sizes (originally I wasn't going to talk about this, but since you brought it up..). Take int32_t, for example. In nearly every situation I've seen, there was never a need for 32bits integers. In fact, more then likely, a 16bit integer is more then enough. The problem with defining the number of bytes, is that it does not scale at all. On a 16bit CPU, int32_t is now a very slow type. Plus, the 16bit CPU is far more limited in things like memory, so those extra 16bits aren't going to do you any good. Now take a 64bit cpu. Again, int32_t is a slower type. Plus, here are you limiting your program to handle up to 32bits.
If you just use the native type, and let the compiler handle size restraints, then your program will scale far better. Not to mention that it'll generally have better performance.
Here is a general table of the types, and what I use them for
CODE
char: At least 8 bits
Great for saving space in arrays, if 256 values is enough
short: At least 16 bits
Same as above, but up to 65535 values
int: Native size of the CPU
Great when performance matters
long: At least 32bits
Great for handling files in 16bit environments
A
WORD is typically the size of the CPU bits. IE, that translates to a int, which does scale far better.
This post has been edited by Cerolobo: 18 Jul, 2008 - 10:16 AM