But when overstocking a tank or putting BIG fish in an undersized tank, stunting is exactly what you get.
Strictly speaking stunting is a result of water quality, not tank size, though there are some other factors I'd rather not get into in this thread since we've already gotten slightly off topic. You can stunt a fish in a large tank without maintenance whereas you can have a non-stunted fish in a smaller tank with something like a drip system changing out water 24/7. Assuming the fish is not physically too large to move in the aquarium.
There are a lot of educational institutions that grow out fish in enclosures that would be considered "overstocked" judging by the amount or size of the fish per enclosure, but they have drip systems changing out water constantly so nitrates and other organics are low or nonexistent. Public aquariums for instance often get away with a large amount of stocking due to their filtration and water change out scheme, whereas the
average hobbyist with that set up WOULD indeed have stunted fish.
If you take the Tennessee Aquarium for instance, who grows out sturgeon for release, they have a "touch tank" with juvenile sturgeon that at first glance appears much too highly stocked. But if you ask about their filtration scheme it would soon be evident that the water quality is not degraded due to that stocking level.
So there are many more factors that lead to stunting rather than just tank size compared to the size or amount of fish.
When we talk about overstocked there are two definitions depending on context. Overstocked as in many more fish than generally should be in the tank, but with a filtration and water change scheme that keeps water quality perfect. (There are plenty of hobbyists that overstock by this definition without detriment to the fish, so you cannot know whether someone is stunting their fish sheerly based on their stock list).
Or the definition used by people to refer to an amount of fish that will degrade water quality based on the persons filtration and maintenance schedule.
By the first definition you can be overstocked and still have healthy fish. The second definition is where we end up with fish that are stunted.
So it's not really fair to assume that someone has poor water quality and is stunting their fish based on their stock list for the size of their aquarium.
---------
Lillyan - as far as an unusual fish that can be kept in a 40 breeder, since you've discounted bichirs, how about something like dwarf pike cichlids? They have an elongate shape and are pretty interesting.