views:

19

answers:

2

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.

thanks, Nick

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

A: 

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.

AshleysBrain
kinda makes sense, but "null" is pretty self explanatory =)
Nick
+2  A: 

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.

Joel Rondeau
what can I say...I'm a rebel
Nick