This is what Bonjour (nee Rendezvous aka Zeroconf) does in life, and Windows machines do the same thing. Hostnames are not private otherwise why would you need a name in the first place?
PS: I'm guessing here that the iOS behaviour when it comes to hostnames is similar to Lion's.
[1] http://developer.apple.com/library/mac/documentation/Cocoa/C...
Make sure to sync it afterwards
To confirm it kicked in, open Applications -> Utilities -> Terminal and type 'hostname'. This is what anyone else on the same network sees you as. You'll also see your machine on other Macs in Finder under the 'Devices' sidebar.
(the whole story surrounding hostnames is moderately more complicated than this, but the Sharing panel on System Preferences is what informs the Bonjour local network name and that's good enough for 95% of user-facing things)
Edit: I misread, thought you were talking about OSX.