deinfing pins in a sketch?

So I am confused about how to declare pin states in a sketch, when there doesnt seem to be any standard constants naming system across all the arduino products. For example, the pin names for declaring on an Arduino Pro is different to the bootloaded Arduino chip ATmega328.

So if I want to read the analog channel 5 (which on the atmega328 is analog pin PC5/ADC5) I am supposed to write analogRead(5);
But if I want to call up the digital pinPD5? Why cant I write digitalRead(PD5)? That is the name the datasheet gives to the pin… I guess what I am trying to say is there doesnt seem to be a way to know what to call a pin for any one occasion, especially if you are not using one of the arduino breakout boards but using an isolated arduino-loaded chip… I attached the pin diagram for the ATmega328 for reference.


The Arduino names the pins to try an protect the beginning user form the concept of "ports" which is confusing and not very useful on a processor where most of the pins serve multiple purposes.

If you have the Arduino bootloader on your AVR processor and you are using the Arduino IDE to program it you should probably use the Arduino pin names/numbers.

If you are using an ATmega chip without a botloader and some other AVR development environment you should probably use the AVR pin names.