The laws for this vary by location. According to federal regulations imposed by the U.S. Department of Transportation, the windshield is required to be free from damage in any area that might hinder the driver's vision.
The U.S. Department of Transportation has laid out a set of regulations which every state is required to enforce, and slight variations exist from state to state. The ruling concerning cracks on the windshield is covered in section 393.60 of the Federal Motor Carrier Safety Administration Guide, which is available online.
The area visible above the steering wheel must be clear with the exception of a 2-inch margin from the windshield border. From side to side, there must be no damage excepting a 1-inch border.
Exclusions from this rule include a small crack which is not intersected by another crack, or any damaged area smaller than 19 millimeters in diameter and separated by at least 3 inches from another damaged area. Whether a crack obstructs the driver's view or not may be established by a law enforcement official.