The end-of-the-world theme of this novel also lends itself towards not using names for the characters. If you think about it, names are the way in which we differentiate ourselves from others, and how we carry on our family names. What would be the purpose of names in a world where mankind is going extinct. I think McCarthy is reinforcing the drab, gray, lifeless and largely hopeless setting of the book by not giving us specific characters to become attached to.
The author has a minimalist style of writing, he is deliberately vague, it makes the story more eerie, the world is lifeless, so it makes you really feel the isolation that exists in this world that is devoid of relationships outside of family. Everyone else is suspect.
The main focus of the story is the aftermath of the apocalypse and the devastation to the landscape and to humanity. The father and son could be anyone, by not giving the characters names, the author gives a sense to the reader, this could be you. It could happen here, it could happen anywhere.
The reader is totally submerged in the post-apocalyptic environment and the struggle.
i believe mccarthy does not give names because in a sense it doesnt matter. all that matters are the father and the boys relationship. it also makes the story more relatable...cormac wants people everywhere to get something from the story and names take away from the lesson hes trying to teach us.