What matters is to keep most possible details in all parts of your image. This means the clear ones (white), medium and the dark ones (black).
Most of the times I do the following :
On the camera I underexpose the photos by 1/3 or 1/5 stop. I do this to keep as much details as possible in the white parts. The dark parts of the image usually are easier to correct and contains more details. So if they are a bit underexposed it is no problem.
On the other hand if in the bright parts no detail is present it is impossible to add some with any correction.
Adjusting the camera for "portrait, landscape, and so on" is not a good idea. I prefer to do the corrections afterwards in the computer. There are much more possibilities and working on a screen is still better than on a little camera. The function on the camera "pictures at night" is the only one I use because then you have all the details you need when you make photos in the evening.
In the image manipulation on the computer are many different ways to obtain a good result. You can try to do it automatically which is good sometimes.
most of the times I divide the picture in three separated parts.The bright, medium en dark ones. I superpose them on the original and edit them separately (density, contrast, color, etc.). According to the result and preferences some parts of these layers can be taken away which shows the underlaying layer. Finally the layers can be added together to make one image again.
This way gives you a better photo than editing the complete image. If for example you adjust the contrast, then the medium parts will be good but you lose details in the white and black parts.
It is more work to do and takes more time but it is one of the advantages of the digital photography. In the old days different types of photographic paper were the only available solutions and we had to work with those ones