Confused about digital and analog pin naming

I'm new to Arduino, and my Nanos haven't arrived yet. But I've worked with Energia, which is a port of the Arduino IDE for TI's MSP430 MCUs, and I'm confused about the definitions of pin names in Arduino. In Energia, pin numbers for digital I/O refer to the actual processor pin number, but in Arduino that appears not to be the case, and apparently it's different for digital and analog pins. Looking through the examples, here's what I find:

Button

Turns on and off a light emitting diode(LED) connected to digital pin 13,
when pressing a pushbutton attached to pin 2.

The circuit:

  • LED attached from pin 13 to ground

  • pushbutton attached to pin 2 from +5V

  • 10K resistor attached to pin 2 from ground

  • Note: on most Arduinos there is already an LED on the board
    attached to pin 13.

const int buttonPin = 2; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin

The LED pin is referred to as pin 13, not as pin D13. It is not actually pin 13 of the 328 (it's pin 17), or pin 13 of the 30-pin Nano board (it's pin 16), but it is the pin labeled as D13. But searching through all of the Examples folder, I can't find a single instancce of anyone defining a pin name as Dn. It's always just the number - 13 in this case. On the other hand, analog pins are always referred to as An.

Is my understanding correct about this? Would it be considered bad programming practice, and confusing to others, if I assigned the LEDpin as D13? Would it even work (i.e. -- will the compiler know "D13")?

Also, I found a discussion here about whether these pin assignment constants should be bytes or ints, but I didn't see where a conclusion was reached. Should pins always be ints? Would using bytes save any room, or just make it worse? I assume the An (and Dn if they exist) values are ints, but does that preclude using byte definitions?

Thanks for any clarification.

In Energia, pin numbers for digital I/O refer to the actual processor pin number, but in Arduino that appears not to be the case, and apparently it's different for digital and analog pins.

That is correct.

Arduino boards have pin names assigned to them and printed on the board. Analogue pins have an A prefix but can also be referred to as regular Arduino pin numbers, ie A0 is Arduino pin number 14 on a Nano board. To avoid confusion it is best to stick to the pin numbers/names printed on the board

So for my Uno as well as my adafruit boards when you define a digital pin you do not need to specify "d" before digital pins. If I read a potentiometer it would be something like analogRead(A4); a button would be digitalRead(10);. The other thing I noticed is that your button is from +5 to a digital pin and to my knowledge its more common to go from ground to a digital or analog pin.

C_Laughrey:
So for my Uno as well as my adafruit boards when you define a digital pin you do not need to specify "d" before digital pins.

Correct

C_Laughrey:
If I read a potentiometer it would be something like analogRead(A4); a button would be digitalRead(10);.

Correct! But remember, analog is only an extra function of that pin! So doing digitalRead(A0) is also perfectly fine.

C_Laughrey:
The other thing I noticed is that your button is from +5 to a digital pin and to my knowledge its more common to go from ground to a digital or analog pin.

It is, only stupid tutorials who this an active low is confusing use a pin between +5V and a pin. So just connect it between a pin and GND and you can also use pinMode(pin, INPUT_PULLUP) to enable the internal pull ups (aka, no need for external pull resistors).