Certain actions can be cancelled by clicking the red cross (
).
Building orders or extensions:
The following graphic explains the resource loss you have by cancelling a building order. This is in order to prevent abuse if you are under attack.

The difference of resources between the costs for the new level and the current level will be lost if one cancels the extension.
Sending troops:
Within the first 90 seconds you can cancel troops which have been sent away by clicking the red cross (
) in the rally point. It doesn't matter if the troops are on a raid, a normal attack or sent as reinforcement.
Why can these actions not be cancelled?
Simply to keep you from abusing them as "extra crannies".