View Single Post
Old 01-22-2013, 08:36 AM   #91
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by stepk View Post
Define as local what for? I mean what's your concern if it isn't defined as local? IFS is a special shell variable, local or global it affects the way sh works. Note that json_parse sets it the resets to its default value when it's finished.
1) Keeps the changes to IFS local to the function ;
2) Does not assume an error-free code path ;
3) Is a matter of good style ;

4) You can drop that "resets it to the default value" thing ;
4.a) Which might be an error - a function can't be certain it was set to the default value on entry ;
4.b) The value of IFS will be the same on exit as on entry.
knc1 is offline   Reply With Quote