Search code examples
c++visual-studiousertype

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

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


Solution

  • 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.