473,405 Members | 2,415 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

defining a simple type

Can anyone tell me if there is a way in C# to do what typedef or #define
could do
in Visual C++?

I want to do something like:
#ifdef SMALL
typedef ushort APPUINT;
#else
typedef ulong APPUINT;
#endif

This way I can have a configuration where I just use /define SMALL to get a
copy that
can't handle large data sets, but has a smaller memory footprint. (It's a
neural network.)

Any help is appreciated.

Donnie Fuqua
df****@awesomenet.net


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Nov 16 '05 #1
1 1166
Donnie Fuqua <df****@awesomenet.net> wrote:
Can anyone tell me if there is a way in C# to do what typedef or #define
could do in Visual C++?

I want to do something like:
#ifdef SMALL
typedef ushort APPUINT;
#else
typedef ulong APPUINT;
#endif

This way I can have a configuration where I just use /define SMALL to
get a copy that can't handle large data sets, but has a smaller
memory footprint. (It's a neural network.)

Any help is appreciated.


You can't, I'm afraid. (Of course, you could run your C# code through a
C/C++ preprocessor, with a bit of work.) One alternative would be to
define a struct APPUINT which either had implicit conversions to/from
ushort or implicit conversions to/from ulong, depending on SMALL. I
don't know what the performance implications of that would be like
though...

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2

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

Similar topics

10
by: Andy B | last post by:
Hi, I am very new to JavaScript and my first assignment is to create a simple game. Below is my code which works fine in IE, but not in any other browser (Opera, Netscape, Mozilla). It has no form...
3
by: fulvio.risso | last post by:
Hello guys. I would like to use the following two types of elements in my XML file: <field type="fixed" size="10"/> <field type="variable" expr="a+b"/> The problem is that I cannot find a...
16
by: Raj Kotaru | last post by:
Hello all, I recently came across the following segment of code that defines a C struct: typedef struct { unsigned char unused_bits:4; unsigned char wchair_state:2; } xyz;
7
by: Kalyani | last post by:
Hi, I have a web service method which needs to return a hashtable.But it gives errror as, The type System.Collections.Hashtable is not supported because it implements IDictionary. Is there...
2
by: Alex Feldman | last post by:
Which of the following is better? Defining an enum type inside a class as a nested type, or in the the namespace? An example of nested type enumerated type would be: public Class Product...
38
by: Steven Bethard | last post by:
> >>> aList = > >>> it = iter(aList) > >>> zip(it, it) > > That behavior is currently an accident. >http://sourceforge.net/tracker/?group_id=5470&atid=105470&func=detail&aid=1121416
2
by: emma_middlebrook | last post by:
Hi <ClubNight Name = "Go club" Date = "2006-09-09"> Discussed a few simple proverbs. <Attendee Name = "RJ"/> <Attendee Name = "TT"/> <Attendee Name = "RB"/> </ClubNight> I'm trying to work...
2
by: srikar | last post by:
Hai I am a beginet to C++, I am having some doubts , these doubts may seem to be simple , but I dont have much idea of them , 1.Q) what is the need of typedefining one function having cetain ...
2
by: =?Utf-8?B?Z2FkeWE=?= | last post by:
I use one of 2 arrays dependent on the country. Rather than say: if exchangeID = 1 then dim myPlaceBets() as As UK.exchange.PlaceBets many statements myPlaceBetsReq.bets = myPlaceBets else...
5
by: Curious | last post by:
Defining your own Entities in a DTD is rather pointless because Firefox & certain other browsers don't read the DTD. Is there a similar mechanism in schemas which works for all browsers?
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.