Is 40C a bad temp for gaming?
There is no ideal temperature for any particular task, whether you're gaming, browsing the web, or doing calculations.
The only bad temperature is a temperature that's out of spec. It depends on your particular processor but the manufacturer should tell you what it is in the datasheet.
For example, we'll take an Intel Core 2 Duo E8600, which is a pretty common processor. It has a minimum operating temperature of 5C and a maximum of "case temperature" of about 74C if you are running it at 65W.
Case temperature basically means "this is the maximum temperature the processor can hit and the stock cooler can move enough heat way from the processor in order to safely operate the processor in standard conditions." In Intel's datasheet for the Core Duo processors, case temperature (Tc) is measured from the surface of the processor at the geometric center. You should probably use the onboard thermometer though and not try to measure it yourself.
If you hit the max you have a couple of options. Cool the case better with more fans, removing the side panel, buying a better case, etc, cool the processor with a better fan, heatsink, or water cooler, or underclock the processor since the amount of heat given off the chip is proportional to the power put into it. The Intel E8600 will do this automatically using two different mechanisms, one cycles clocks on and off and has a small hit to performance, while the other undervolts and underclocks the processor and would have a noticeable impact on performance.
You can find typically find the datasheet for your processor by just googling "<processor> datasheet." For example, here's the Intel E8000 series documentation:
http://www.intel.com/design/core2duo/documentation.htmHere's some thermal characteristics for common AMD processors:
http://support.amd.com/us/Processor_TechDocs/43375.pdfThey're called different things for different processors. Intel and AMD use case temperature, some microcontrollers or other simple processors might call it "temperature under bias," which is simply the temperature it works at when powered. You need to read the thermal documentation carefully and entirely, including footnotes, to figure out the maximum operating temperature, since it's not always obvious which one is the right temperature ("tease temp" is not the right one). Sometimes they'll just give you a formula.
As a rule of thumb, looking through various documentation, 60~70C seemed to be a common temperature. However, it will depend on your processor. I think my laptop runs at 60 something.
If you're running stock parts (no overclocking, no custom coolers), and you have it in a normal room at room temperature (not an unventilated closet, under a stack of papers, or god forbid in a desk drawer in a third floor lecture hall with closed windows in summer) then you don't need to worry about it.