I cannot agree with the part that setting exposure compensation does not affect shutter speed/aperture size.
Let's use a low light situation where getting ambient lighting is important.
If u had taken the shot without a flash, u still can dial in exposure compensation. In this case, if u set +1EV (i.e. overexpose by 1 stop), then if u are in A mode, since u set the aperture (or DOF), then the shutter speed must drop to allow the compensation. If u are in S mode, then the aperture opens one stop to allow more light in. In both cases, the level of ambient light (i.e. background light) is increased. However, the subject exposure also increases by one stop as u let more light in.
Now if u add the flash into the equation, the flash fires regardless of the aperture setting. The flash duration is dependent solely only on the level of reflection of the subject that the flash meter reads. It is not dependent on the your aperture setting. This is because the change +1EV results in a negligible amount of light increase as compared to the flash, and so the flash output is not affected by the increased ambient lighting.
So the level of ambient lighting as in the earlier "flashless" case, will also increase by one stop by either dropping shutter speed or increasing aperture size depending on the mode u use. Now the flash will fire such that the subject will be lit the same as in the earlier "flashless" case. The reason is that the flash output is controlled by the amount of reflection through the lens. Once the flash meter detects that the subject is lit properly, it cuts the flash burst.
Therefore while it is correct to say that exposure compensation alters the lighting of the total frame, the flsh compensates via TTL/ADI/matrix metering to light up the subjct properly. This means that if u dial in +1 EV, then the flash duration will cut due to the increased amount of light reaching the film plane from the larger aperture or slower shutter speed. Therefore the ambient light increases while the exposure for the subject remains constant. In which case, the increased ambient light is due to the change in either shutter speed or aperture size.
Now if u dial in flash compensation, and if u dial in +1/2 stop, then what will happen is that the subject will be overexposed by 1/2 stop now. Cos u force the flash to fire for a longer duration that what the camera's onboard computer calculated as the suitable timing. But since the aperture size did not change (with the increased flash duration), then the background (which inherently is darker in low light) will still look ok since the aperture set + the exposure compensation was already right for the level of exposure of the background that u wanted.
I hope i am clear........