I used to do it when I was at school every now and then and it wasn't that bad. Unless you mean you're only staying up all night to study for something you should have been studying for in advance - and only if you had to study for it anyway. I used to do it when I'd be sitting there at 4am and start to realize that I'd be awake in three hours time anyway, and that sleeping for three hours would just make me feel terrible when I did wake up. However, sleeping in school during private study was always a good way to combat this.