LWN.net Logo

(off-topic) Searching for variables

(off-topic) Searching for variables

Posted Nov 18, 2008 18:40 UTC (Tue) by pjm (subscriber, #2080)
In reply to: Placement of variable declarations in C by tjc
Parent article: A potential competitor for GCC: pcc

You would benefit a lot from learning regular expressions. If you use vim, then it suffices to type ‘*’ when the cursor is over an ‘i’ variable to find all occurrences of ‘i’ as a “word” (so excluding ‘if’ etc.).

Many IDEs go one step farther and allow searching for just the current variable as distinct from other variables & functions of the same name.

Incidentally, I hope that the original poster is joking (as the ‘;-)’ suggests) in the suggestion to use a shared variable for all temporaries. Such sharing makes it harder to modify one use of the variable because one needs to check whether subsequent code is using the resulting value.


(Log in to post comments)

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds