performance - Objective-C: Function-Like Macro Vs. Method -


in objective-c, when recommend using function-like macros on class or instance methods?

they're different things. function or method exists once in code; macro inserts entire definition code every time use it.

some people take advantage of fact short macro can expand chunk of code, rather cheap substitute c++ style templates. matt gallagher's singleton macro 1 example. , templates, overuse of large macros can lead surprisingly large code , big debugging headaches.

aside constants , tiny expressions, if can use function or method in place of macro, should.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -