473,467 Members | 1,585 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Compile time constants

Is there a way with Visual Studio 2003 and 2005 to list the name a value of
compile time constants like those created with #define statements.

Right now I have the need to use the same C# code in 2003 and 2005 and need
to know which version is doing the work. I could create one but if there is
already one there I would rather use it.
Thanks
Apr 16 '07 #1
1 1519
<ne***************@charter.netwrote:
Is there a way with Visual Studio 2003 and 2005 to list the name a value of
compile time constants like those created with #define statements.

Right now I have the need to use the same C# code in 2003 and 2005 and need
to know which version is doing the work. I could create one but if there is
already one there I would rather use it.
The "pre-processor" symbols in C# don't have values. However, you could
do:

#if VS2003
const int Version = 2003;
#else
const int Version = 2005;
#endif

I don't believe there's anything in the default project settings to
define "VS2003" or anything like that, but you can easily put them in.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Apr 17 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Nick Coghlan | last post by:
Time for another random syntax idea. . . So, I was tinkering in the interactive interpreter, and came up with the following one-size-fits-most default argument hack: Py> x = 1 Py> def...
13
by: JKop | last post by:
The following compiles for me with G++: const unsigned int z(5U); unsigned int y(5 + 6 - 4 / 2 + 3 * 6 - z); inline unsigned int x() { return y * 4 + z - 9 * 3;
2
by: Glen | last post by:
I'm working on a custom assembly and I'm trying to figure out the best approach to handling known constraints within the assembly, once compiled, to alert the developer at compile time of a...
2
by: Marty | last post by:
Hi, In VB.NET, what happen to constants when compiling? Are they copied at every place they are needed? Or the application has to refer to constants address each time it need it at run time? ...
4
by: Dave Rahardja | last post by:
I have the following program that uses an array of chars to simulate a bit set: --------- // An out-of-bounds exception class BoundsException {}; template <int bits = 1> class Bitset
3
by: Jason S | last post by:
is there any way to use templates to bind integer/floating point constants to a template for compile-time use? e.g. template <double conversion> class meters { const factor = conversion;
2
by: Frederick Gotham | last post by:
I don't like macros for a few reasons -- here's just a few... Reason 1: namespace ArbitraryNamespace { #define Func(i) ( i + '0' ) }
15
by: steve yee | last post by:
i want to detect if the compile is 32 bits or 64 bits in the source code itself. so different code are compiled respectively. how to do this?
1
by: newscorrespondent | last post by:
Is there a way with Visual Studio 2003 and 2005 to list the name a value of compile time constants like those created with #define statements. Right now I have the need to use the same C# code in...
22
by: Tomás Ó hÉilidhe | last post by:
I've been developing a C89 microcontroller application for a while now and I've been testing its compilation using gcc. I've gotten zero errors and zero warnings with gcc, but now that I've moved...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.