This comes from Dr. Jacob Teitelbaum, a really wonderful M.D. whom I have seen speak.
Besides concerns related to dying, the main fears and problems facing people with cancer are the fear of pain and the fear of social isolation. The latter often occurs because people are afraid to talk about death and dying, and therefore have trouble being present with those with cancer. Because of this, I encourage you to let those you know with cancer talk about their feelings, fears, concerns and hopes. It is not as necessary to offer them hope and reasons for optimism (though these can be helpful after they've shared their feelings) as it is to let them express how they feel and know they've been heard. A simple hug after hearing them out (or even crying with them) can be very healing and set the stage for healing.
I personally believe that death here is simply a rebirth elsewhere (whether one chooses to call it heaven or another name) and is not the enemy—simply a transition to be made when the time is right. For those who hold this belief and a belief in God, talking about this can also be healing. For those who do not believe in an afterlife, a key is letting the person know how they have positively impacted your life, that they are loved, and that they will be remembered lovingly—while giving both the person and the listener the chance to share whatever feelings are present (even if this means "clearing the air"). In this way, they know they will live on in the memories of those who love them. Either way, let them know they will not be alone, and that you will be their advocate to be sure they stay pain free. At the same time, take care of yourself as well (see "Caring for the Caregiver in Chronic Illness").
Let me make a simple statement. It is never acceptable for cancer patients to be in ongoing pain, and the treatments discussed in this article and my book "Pain Free 1-2-3" can be very helpful in eliminating cancer pain. In addition, cancers that physicians have no treatment for are often still very treatable.