while (curr_data[1] != (unsigned int)NULL &&
((curr_ptr = (void*)curr_data[1]) || 1))
Two part question.
What will (curr_ptr = (void*)curr_data[1]) evaluate to, logically. TRUE?
Also, I know its rather hack-ish, but is the while statement legal C? I would have to go through great contortions to put the assignment elsewhere in the code, so I’d be really nice if I could leave it there, but if it’s so egregious that it makes everyone’s eyeballs burst into flames, I’ll change it.
To answer your questions:
curr_ptrisn’t set toNULL(i.e.curr_data[1]isn’t 0).Anyway, I’m assuming you didn’t write this code, because you’re debating about leaving it in vs. taking it out. So I want you to find out who wrote this line of code and introduce them to a heavy blunt object.
(unsigned int)NULLis ridiculous. Why would you do this? This will probably be the same as just writing0(not sure if that’s guaranteed by the standard).curr_data[1]if it’s being cast to a pointer (and pointers are being cast to it)? If it’s supposed to be holding a pointer as an integral type, you should use the typeintptr_toruintptr_tprovided in<stdint.h>for that purpose (if you’re compiler doesn’t support C99ptrdiff_tmay be an acceptable substitute).|| 1at the end seems to be redundant. Ifcurr_ptr = (void*)curr_data[1]would have evaluated to false, we would have caught that in the first condition.It may be a pain in the ass, but seriously reconsider rewriting this line. It looks like an entry in the IOCCC.