473,395 Members | 1,568 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,395 software developers and data experts.

#define from c++ to c#

AMP
I have all these #define commands in a c++ file I am converting to C#.
They usually have a value assigned to them:
#define BSL_TXBLK 0x12

What is the c# equivalent for this.
(It wont accept these,I dont think)
"Cannot define/undefine preproccessor symbols after first token in
file"

Thanks,
Mike

Aug 15 '06 #1
6 2590
AMP wrote:
#define BSL_TXBLK 0x12
What is the c# equivalent for this.
Use constants, e.g. const int BSL_TXBLK = 0x12;

Eq.
Aug 15 '06 #2
Hello AMP,

use const/readonly statements

AI have all these #define commands in a c++ file I am converting to
AC#.
AThey usually have a value assigned to them:
A#define BSL_TXBLK 0x12
AWhat is the c# equivalent for this.
A(It wont accept these,I dont think)
A"Cannot define/undefine preproccessor symbols after first token in
Afile"
AThanks,
AMike
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Aug 15 '06 #3
It's just const. Read only statements would imply that the value can be
changed at run time, which is a different semantic than a #define statement
in C++.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Michael Nemtsev" <ne*****@msn.comwrote in message
news:9c**************************@msnews.microsoft .com...
Hello AMP,

use const/readonly statements

AI have all these #define commands in a c++ file I am converting to
AC#.
AThey usually have a value assigned to them:
A#define BSL_TXBLK 0x12
AWhat is the c# equivalent for this.
A(It wont accept these,I dont think)
A"Cannot define/undefine preproccessor symbols after first token in
Afile"
AThanks,
AMike
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do
not cease to be insipid." (c) Friedrich Nietzsche


Aug 15 '06 #4
AMP
Thanks guys!!!
Michael Nemtsev wrote:
Hello AMP,

use const/readonly statements

AI have all these #define commands in a c++ file I am converting to
AC#.
AThey usually have a value assigned to them:
A#define BSL_TXBLK 0x12
AWhat is the c# equivalent for this.
A(It wont accept these,I dont think)
A"Cannot define/undefine preproccessor symbols after first token in
Afile"
AThanks,
AMike
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Aug 15 '06 #5
"AMP" <am******@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
>I have all these #define commands in a c++ file I am converting to C#.
They usually have a value assigned to them:
#define BSL_TXBLK 0x12

What is the c# equivalent for this.
http://www.google.co.uk/search?sourc...3%22+const+hex
Aug 15 '06 #6
Hello Nicholas Paldino [.NET/C# MVP],

yep. Should be more specific.

NIt's just const. Read only statements would imply that the value
Ncan be changed at run time, which is a different semantic than a
N#define statement in C++.

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Aug 15 '06 #7

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

Similar topics

18
by: Bryan Parkoff | last post by:
"#define" can only be inside the global scope before main() function. "#if" can be tested after "#define" is executed. The problem is that "#define" can't be inside main() function. I do not wish...
2
by: Andreas | last post by:
Hi! I'm using an IplImage library from camellia.sourceforge.net, and the testbench calls a file only containing code like the one below. In cam_morphomaths_code.c the real computation is made,...
3
by: theotyflos | last post by:
Hi all, I have the following: /*--- SNIP ---*/ typedef struct Argument_s { char *address; int type;
9
by: pozz | last post by:
Hi all, I have the below #defines #define NUMBER1 30 #define NUMBER2 50 #define SUM (NUMBER1+NUMBER2) #define STRING1 "Byte: \x30" #define STRING2 "Byte: \x50"...
34
by: BQ | last post by:
Hello Is there a way to declare 'FUNCT' via a define so that if its parameter x, a constant, is greater than 35, it returns 56, if not, 20. I would like that at compile time, not at run time. ...
17
by: niraj.tiwari | last post by:
What is meaning of the following define:- #define x(argl...) x1(##argl)
71
by: David T. Ashley | last post by:
Where is the best place to define TRUE and FALSE? Are they in any of the standard include files, ever? Do any standards apply? What I've traditionally done is something like: #ifndef...
6
by: anirbid.banerjee | last post by:
Hi, I need to write a macro which would have a lot many conditional #ifdef ... #endif blocks in it. #define _xx_macro (x) { ... \ ... \ /* some code (); */ #ifdef _SOME_STMT \ ... \ ... \
23
by: anon.asdf | last post by:
Hello! In the following code-snippet, is it possible to initialize each element of arr, with STRUCT_INIT? struct mystruct { int a; char b; };
2
by: badc0de | last post by:
Hello.. a header file of one of my project has macro definitions like this (for example) #define PART_A_SORT_1_LABEL_STRING1 100 #define PART_A_SORT_1_LABEL_STRING2 200 #define...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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:
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...

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.