Dress Code: Mostly these are recommendations so people that like to dress up know that this is the night to do it.
Rather, it is the right of the host (ship) to prescribe the proper dress for an event (dinner, show, etc.) and the social obligation of all who attend to conform.
Everyone is on vacation so it would be difficult to turn anyone away from dining because of dress.
Actually, it's quite easy. "I'm sorry, [sir | ma'am], but this evening is formal so you'll have to change into the prsecribed attire to come into the [dining room | show room | casino | lounge]." usually works. If not, the member of the ship's staff who delivers those words in firm tone can call security to back them up.
(I went 8 days without luggage and always went to dinner).
Most major cruise lines now provide complementary use of their rental formalwear for passengers who are caught in that bind.
On a South American cruise we were in a forward lounge and a man walks in and up to the bar with nothing but a "J" strap on. He was helped back to his room. We couldn't decide to laugh, giggle or choke.
Now that is a dress code that should be enforced.
I agree completely!