It is both safe and permitted but put 'em in a plastic bag just in case or you may have beer soaked undies if you come across a ramp rat that likes to drop bags from a great height!
Can't say specifically for the A340 but all holds are pressurised in an A320, though not all heated (dogs and cats to the rear please).
Enjoy your trip...