what is this code means?

I compiled from other's project, everthing is ok, but I could not get some information on these advanced code.so please tell me.thanks.

uint8_t i=8;
what is this uint8_t and uint16_t?

and this:
2. what is this code?

uint16_t free_ram(void)
{
extern int __bss_end;
extern int *__brkval;
uint16_t free_memory;

if((int)__brkval == 0)
{
free_memory = ((int)&free_memory) - ((int)&__bss_end);
}
else
{
free_memory = ((int)&free_memory) - ((int)__brkval);
}
return free_memory;

} // end of free_ram

3.what is avr/wdt.h?
#include <avr/wdt.h>

4.whether I can get the definition of (AVR_ATmega328P)
#if defined (AVR_ATmega328P) || defined (AVR_ATmega328) // Arduino Uno hardware I2C pins

uint8_t is an eight bit unsigned datatype
uint16_t is a sixteen bit unsigned datatype.

free_ram tries to do what it says on the can - it tells you roughly how much free RAM you have.

WDT stands for "watchdog timer".

The values are provided at compile-time via the compiler command-line

youxiaojie:
1.

uint8_t i=8;
what is this uint8_t and uint16_t?

It is a type declaration. They are defined to be unsinged 'u' and contain exactly 8 and 16 bits.
On an Arduino Uno, a 'byte' data type is the same as uint8_t and an unsigned int is the same as a uint16_t;
It is a method for specifying excactly how large you want a variable that makes sure it is the same across different platforms

and this:
2. what is this code?

uint16_t free_ram(void)
{
extern int __bss_end;
extern int *__brkval;
uint16_t free_memory;

if((int)__brkval == 0)
{
free_memory = ((int)&free_memory) - ((int)&__bss_end);
}
else
{
free_memory = ((int)&free_memory) - ((int)__brkval);
}
return free_memory;

} // end of free_ram

It is a function that reports how much free memory the processor has at that moment

3.what is avr/wdt.h?
#include <avr/wdt.h>

it is the Watchdog Timer. Google is your friend here.

4.whether I can get the definition of (AVR_ATmega328P)
#if defined (AVR_ATmega328P) || defined (AVR_ATmega328) // Arduino Uno hardware I2C pins

It is a compile type constant the changes depending on what board type you select. This allows code to change based on the differences between different processors. The exact value is not important, just the fact that it is defined or not. You could always put it into a Serial.print() statement to see.

Thanks.
but is this standard arduino function? I have never seen such on Arduino Reference - Arduino Reference.