We examine the formation conditions of icy planetesimals produced in protoplanetary disks. Assuming that these solids are made from hydrates,clathrate hydrates and pure condensates from a homogeneous gas-phase, we show that their composition does not depend on the thermodynamic conditions adopted for the disk. Instead, we find that it is rather influenced by the variation of the C/O ratio in the gas phase. We then discuss the implications of these calculations for the composition of cool planets. We also give an estimate of the abundance of volatiles that could be measured in the atmospheres of Jupiter-like planets.