Bunny, yes, the "caliber" on any naval rifle or cannon refers to the barrel length...you can roughly conclude the velocity from that too comparing gun to gun...for example while both opposing DDs (say Jap and US) might have 5" guns, or both of their Cruisers might face each other with 6" or 8" guns, the LONGER tubes would give one or the other an advantage in a surface fight with regard to range...so while the 5"/50 cal DD guns from preWWII and the 5"/38s of most WWII DDs fired technically the same shell WEIGHT, the /50s would throw them farther (usually bigger powder capacity) and with more velocity...but then the shorter barreled guns USUALLY had a higher rate of fire, and could be "trained" faster....
But the SHORTER barrel is also needed for high elevation, such as for "dual-purpose" or AA only use, so that is why a lot of WWI and pre-WWII DDs carried "mixed" weaponry, with 4"/50s, or 5"/50s, or maybe even 3"/50s for "surface" targets, and a couple of 3"/(shorter) "high angle" guns that were "AA only." So consequently they had relatively lighter armament than they could have had for BOTH Surface or AA use, and were really pretty light on the AA....plus had to carry two or more types and sizes of shells for the two different "main" guns.
The 5"/38 was perfect for both, with sighting systems and fire control for surface and AA targets, (hence Dual-purpose)and gave the WWII DD and DE the full main battery for A/ship, but all were highly effective for AA too, not even accounting for the new "proximity' fuses and the automatic (actually "semi-auto") rapid fire capability which made them DEADLY.
Interestingly, I have heard that the longer barreled 4" and 5" guns were more accurate than the 5"/38s, but they more than made up for it with the rapid fire, and with proximity fuses, "close" was usually good enough.
If Xracer gets on, he can give you a lot of first-hand experience with them too....