Body
And I thought I'll never do such things again ?
I wanted to insert a debugging statement at the beginning of each function.
for i in *.cc *.c; do sed -i -e 's/\([a-zA-Z0-9 _*:~]*([^).]*) *{\)/\1 \nprintf("%s\\n", __PRETTY_FUNCTION__); /g' $i; done
It can probably be used to insert anything too.
It's dirty but it worked for me. Just keep a backup or make sure the latest code is in any RCS just in case.
It only failed with a function that was commented using C++ style comments "//".
I didn't try it with class methods defined inside header files
- 50264 views
Add new comment