News for hackers. Stuff that matters.
Re:In C++, is empty() faster than comparing the size with zero? by joosters on Thursday October 28, 2021 @02:37PM (#29029693)
Sure, but I understand why the C spec does not define this - because not all processors can trap these events, at all times and in all situations, without added costs. And C is very much of the opinion that it doesn't want added costs - but it lets you pick and choose what you want, hence the compiler options.

I don't think there's an obvious 'good' and 'bad' choice here.

Re:In C++, is empty() faster than comparing the size with zero? by admax88qqq on Thursday October 28, 2021 @06:31PM (#29032865)
I think the "good" choice is to remove undefined behaviour and accept that C will be slighlty slower on esoteric hardware.
Re:In C++, is empty() faster than comparing the size with zero? by saagarjha on Thursday October 28, 2021 @10:56PM (#29034689)
This will make C much slower on your hardware, too.