Assign values to keywords in usertype.dat in visual studio?
I found that if you create a file called "usertype.dat" in visual studio's IDE dir, that you can specify keywords that will appear in blue like "new" or "int".
Is there a way to assign values to these? I don't want to have to use "#define [keyword] [value]" in every single file that I use..
Specifically, I would like to have a "null = 0" keyword without having to include windows.h or hold shift to type it every time.
edit: I found that you can add a compiler directive to do it!
/Dnull=0开发者_JS百科I guess its not the end of the world if I have to add that to my projects, but it would be nice if I could get visual studio to do it automatically
One option you would have is to go to the project (or file) properties page and add a preprocessor definition of null=0
. Having said that, I agree with @AshleysBrain that this is bad form and you're better off using the already defined item.
No, you can't do that, all you can do is write a header file with your favourite keywords in it and include it in your projects. I wouldn't recommend inventing your own keywords though - it'll make it harder for other programmers to read and understand (and yourself in 6 months counts as another programmer!). Just use NULL
instead of null
like everyone else, or get a C++0x compiler and use nullptr
.
精彩评论