预定义常量,预处理器指令等... [英] Pre-defined Constants, preprocessor directives, etc...

查看:70
本文介绍了预定义常量,预处理器指令等...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在哪里可以找到所有内置预定义常量的列表.在开发和分发代码时,生成可重用的代码是适当的,但是,并不是每个人都使用相同的编译器.一些使用VS 2005,一些使用2008,其他使用Express版本,其他可能仍使用#Develop开源IDE.我正在寻找应该应该存在的预定义常量,这些常量可以让我将某些代码节保留为特定的版本.

应该有一个预处理程序定义,可以让程序员知道编译器的版本,例如 #if VS2005

#elif VS2008

#endif

甚至更好的版本是确定要编写代码的Framework的版本编译下.尽管.Net框架非常有用,但有时我只想重用代码,而不链接到先前生成的程序集.因此,我可以编写一些适用于2.0、3.0、3.5等的代码,以便在编译我链接到12个不同项目中的一个文件时,它会根据项目的框架等进行编译.
<许多IDE具有这些内置的预处理器定义,这些定义是自动的,因此可以将代码编写为更具可分发性.我在哪里可以找到VC/VB的此类项目列表. al'Raec Ruiner



Where can I find a list of all the built-in pre-defined constants.  When developing code and distributing it, it is appropriate to generate reusable code, however, not everyone uses the same compiler.  Some use VS 2005, some are using 2008, others are using Express editions, others still may be using #Develop open source IDE.  I'm looking to find the predefined constants that should exist that would allow me to taylor some code sections to the specific versions.

There should be a preprocessor define that lets the programmer know the version of the compiler, like
#if VS2005

#elif VS2008

#endif

or even better would be one to determine the Framework the code is being compiled under.  As much as the .Net framework is very helpful, there are times when I just want to reuse code, not link to a previously generated assembly.  thus, i could write some code to work for 2.0, 3.0, 3.5, etc so when that one file that I link to in 12 different projects is compiled, it is compiled according to the framework of the project, etc. 

many IDE's have these built in pre-processor defines that are automatic so code can be written more distributable.  Where can I find the list of such items for VC/VB.

Thanks.

Jaeden "Sifo Dyas" al'Raec Ruiner




推荐答案

据我所知,C#没有这些预定义的宏(例如在C ++中).

另请参见 http://msdn.microsoft.com/en-us/library/ed8yd1ha(vs.71).aspx 并向下滚动到底部,一行显示"与C和C ++指令不同,您不能使用这些指令来创建宏."
As far as I know, C# does not have these pre-defined macros (like in C++).

Also see http://msdn.microsoft.com/en-us/library/ed8yd1ha(vs.71).aspx and scroll down to the bottom, there's a line that says "Unlike C and C++ directives, you cannot use these directives to create macros."


这篇关于预定义常量,预处理器指令等...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆