Who used machicolations?

Machicolations are used in Castles as well as used by military.