I made a bet with my friend to complete a task to write specific software only in one line of code: to display current time in specific order and a text with five characters only once a second. Currently I'm struggling with forcing void into any kind of type. Currently I'm stuck at this:
[c](time_t a)-> char*
{
Sleep(strftime(c, 32, "%H:%M:%S ABCDE", localtime(&a)));
}(a=time(0))
See how I initialized time() to local a by using anonymous functions of C++11 to use that by reference of localtime as it only gets local-scope value. However I'm primarly stuck at using:
void Sleep(DWORD milliseconds);
You can't cast void to any other type or void* as it's non-return type, however in assembler it's always some rubbish value that exists in EAX/RAX register after void return- even if I could grab that 'rubbish' that would finalize my task.
I can use Unix sleep() as it returns UINT, but I'm just curious if it's possible (I Though about __asm block but it can't be used in lambdas)
Aucun commentaire:
Enregistrer un commentaire