I know they put rails on guns now. My own M&P 9c has them. But I personally would never attach a light to a gun and show an opponent where my head and hands are in the dark. Just use a maglight or something equally effective, and hold it out as far to one side as you can, if you must use a light. Keep it away from you head and body.
Bear in mind, I am thinking "self defense" here. Perhaps there are other uses for lights on guns? If you engaged in a firefight in the dark, or even before a fight might start, why give away your position and provide your potential assailant a beacon to show where you are at all times? Even when one fires in the dark, one must move quickly in some lateral direction, to avoid drawing fire.
Perhaps the police have a use for lights mounted on pistols, but does the armed citizen? Is it even a reasonable idea?