[SVN] r9542 (C)

Allan Odgaard throw-away-2 at macromates.com
Thu May 8 20:20:44 UTC 2008


• change to use a UUID instead of _FILENAME_

Our previous macro name was in disagreement with C/C++ naming conventions¹.

I searched for a convention for include guards and found this in the C++ FAQ:

    […] It is recommended to add some project unique part, and
    if you are using a directory hierarchy also that, e.g.
    MYPROJ_BAR_FOO_HPP if it resides in bar/foo.hpp

I considered this, i.e. using the full path, but ended up with the UUID since that is bullet-proof and looks consistent. The FAQ’s suggested solution is still only a heuristic, adds about the same noise as a UUID, the path of the file may likely change throughout the life of it, and project name is not always known.

The downside is of course that the macro name is nonsensical if part of compiler output or similar.

I am interested in feedback on this change — I’ve wanted to change the generated name for a long time, but lack of a good convention has made me delay it.

¹ Names beginning with double underscore or an underscore and a capital letter are reserved for implementation (compiler, standard library) and should not be used.

Changed:
U   trunk/Bundles/C.tmbundle/Snippets/Include header once only guard.plist



More information about the textmate-dev mailing list