Hi All, one C coding convention I think is extremely useful for finding definitions is to always put the name of a function (not its forward declaration but its definition) on a newline, so that instead of writing e.g
static void recordKeyboardEventCarbon(EventRef event) { you write static void recordKeyboardEventCarbon(EventRef event) {
This makes it really easy to find the sole definition in text editors and using grep etc. If people feel they could live with this convention could I be allowed to make this change throughout the platform code base after code freeze and before the release so that this convention will be available to us all in the future?
best Eliot
|
On 19 January 2011 21:18, Eliot Miranda <[hidden email]> wrote: > > Hi All, > one C coding convention I think is extremely useful for finding definitions is to always put the name of a function (not its forward declaration but its definition) on a newline, so that instead of writing e.g > static void recordKeyboardEventCarbon(EventRef event) { > you write > static void > recordKeyboardEventCarbon(EventRef event) { > This makes it really easy to find the sole definition in text editors and using grep etc. grep recordKeyboardEventCarbon.*\{$ will find anything that having { in the end, so it will skip the declarations.. (as well as definitions if curly brace are on next line :) > If people feel they could live with this convention could I be allowed to make this change throughout the platform code base after code freeze and before the release so that this convention will be available to us all in the future? yeah it's a pain to find the definition using grep.. A good C/C++ IDE helps a lot in this regard.. unfortunately not all platforms having decent IDEs.. (Xcode is a piece of shit ;) ). currently i using things like this: find -type f | xargs grep fooo where foo is my search string/pattern :) > best > Eliot > -- Best regards, Igor Stasenko AKA sig. |
On Wed, Jan 19, 2011 at 12:50 PM, Igor Stasenko <[hidden email]> wrote:
This gets confused by if (myFunction(blah)) { and doesn't work in a text editor.
and which should one use across Mac OS X, Win32 and Linux? A simple cross-platform convention means not having to choose. unfortunately not all platforms having decent IDEs.. (Xcode is a piece It has its place; it has its limitations, as do they all. Hence my motivation for a really simple IDE-independent cross-platform scheme for finding definitions. currently i using things like this: |
In reply to this post by Igor Stasenko
2011/1/19 Igor Stasenko <[hidden email]> yeah it's a pain to find the definition using grep.. A good C/C++ IDE I can recommend etags and emacs in this regard. # create the TAGS file at the root of the platforms code rm -f TAGS find platforms -type f -iname "*.[ch]" -exec etags --append {} \; # Start with a file you want to examine emacs platforms/unix/src/vm/interp.c Now place the cursor on any function/macro/struct/... you want to look up the definition and type M-. (find-tag) (Doing this the first time you have to say that you want to use above created TAG file) and it will jump to the file and definition. There are also other commands that will jump to every use of a function etc. Alex PS: There is emacs for macs and windoze PPS: There are rumors that there is something similar as etags for another editor called vi PPPS: Xcode can't be worse than VisualStudio |
no problem for me. And yes, xcode sucks badly, and visualstudio sucks worst :( El 19/01/2011, a las 7:13p.m., Alexander Lazarević escribió: 2011/1/19 Igor Stasenko <[hidden email]> |
In reply to this post by laza
On Wed, Jan 19, 2011 at 11:13:23PM +0100, Alexander Lazarevi?? wrote: > > PPS: There are rumors that there is something similar as etags for another > editor called vi ctags |
Free forum by Nabble | Edit this page |