Inhaling vomited stomach contents into your lungs is called "aspiration", and can be dangerous. Fortunately your body has an effective mechanism to stop this from happening. Unfortunately when you are unconscious this mechanism does not work, so it's best that your stomach is empty when you have a general anesthetic. In emergency surgery when you may have eaten recently your anesthesiologist will take special precautions to reduce the risk of aspiration. Even if you are booked to have a regional anesthetic, it is important to follow the instructions about not eating and drinking, just in case it becomes necessary for you to have a general anesthetic.