Assign values to keywords in usertype.dat in visual studio?

1k Views Asked by At

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

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

2

There are 2 best solutions below

0
On BEST ANSWER

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.

1
On

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.