On steam locomotives, the cab is normally located to the rear of the firebox, although steam locomotives have sometimes been constructed in a cab forward configuration. A few locos had "camel-back" or "Mother Hubbard" style cabs positioned in the center of a boiler due to excessively wide fireboxes which prevented the cab from being located at the rear of the boiler. These locos often burned anthracite.
The cab, crew or driver's compartment of a diesel or electric locomotive will usually be found either inside a cabin attached to a hood unit or cowl unit locomotive, or forming one of the structural elements of a cab unit locomotive.
The inside of a steam locomotive contains the controls, firebox hatch doors, crew seats, and small walk space to the tender or bunker.In addition to the locomotive controls in a diesel locomotive; a cab will typically be fitted with windshields, side windows, crew seats, heating, and sometimes radios, air conditioning and toilets. (Same with most electric locomotives.)
In Europe, many modern locomotives are cab units with two cabs, one at each end. However, the locomotives powering some high speed European trains are normally cab units with one cab, and European shunting/switching locomotives are usually "hood" units.
The size of cabs varies in North America for all types of diesel or electric locomotives. Hence, the "standard" cab consists of having a narrow hood with a narrow short nose, which was once the standard and main form of cab; while the "wide-nose" (not wide-cab; the cab is the same width) is the safer, sleeker, more efficient cab used for locomotives, which has actually become the new form of standard cab.