문제

Is is possible to redefine 'break' in such a way that I can just write 'torsk' instead? E.g:

switch (chocolateistasty) {

    case true: {
        cout << "It is!" << endl;
        torsk;
    }
    case false: {
        cout << "Nope." << endl;
        torsk;
    }
}

I imagine this would be done with some preprocessor commands.

도움이 되었습니까?

해결책

#define torsk break

but I also wonder why would you want such weird thing...

다른 팁

Yes you can do it with preprocessor

#define torsk break

you can do anything you want like

#define forever for(;;)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top