objective c - #define ... method call. Why? -


i have come across of sort of thing in codebase need across:

#define timestamp [nsstring stringwithformat:@"%d",(int)([[nsdate date] timeintervalsince1970]) ] 

why this, opposed creating method in implementation? seems such odd thing do, there must benefit it.

i have seen done in c lot, make code inline rather in separate function

it removes overhead of calling function, when function line long.it forces inline

pretty compiler make small function in-line anyway there isn't reason this. more of stylistic choice. error-prone


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -