473,568 Members | 2,795 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

code after preprocessor / macro

Hi,
I have written C# code. And I have used preprocessor / macro in it.

I want to get the C# code after processing preprocessor, I have defined
durcng compile time. How can I get this code?

Is there any csc compiler option, that can produce the code after processing
the macros/preprocessors?

Thank you,
Avin Patel
Nov 16 '05 #1
3 2010
Avin Patel <Av*******@disc ussions.microso ft.com> wrote:
I have written C# code. And I have used preprocessor / macro in it.

I want to get the C# code after processing preprocessor, I have defined
durcng compile time. How can I get this code?

Is there any csc compiler option, that can produce the code after processing
the macros/preprocessors?


No - C# doesn't *have* macros or a preprocessor. It has "pre-processing
directives" which are named that way because they look similar to C/C++
ones, but there's no actual pre-processor.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
Hi,
Well, It doesn't matter, What you call? MACRO, preprocessor or
*pre-processor directive* Or act like preprocessor. In the end it does the
same job as the C++ pre-processor does.

So my question is, How can I get the C# code after compiler has done
processing this "pre-processor"?
As the C++ compiler has the facility to obtain the C++ code after compiler
has done pre-processing.

Thank You,
Avin Patel

"Jon Skeet [C# MVP]" wrote:
Avin Patel <Av*******@disc ussions.microso ft.com> wrote:
I have written C# code. And I have used preprocessor / macro in it.

I want to get the C# code after processing preprocessor, I have defined
durcng compile time. How can I get this code?

Is there any csc compiler option, that can produce the code after processing
the macros/preprocessors?


No - C# doesn't *have* macros or a preprocessor. It has "pre-processing
directives" which are named that way because they look similar to C/C++
ones, but there's no actual pre-processor.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #3
Avin Patel <Av*******@disc ussions.microso ft.com> wrote:
Well, It doesn't matter, What you call? MACRO, preprocessor or
*pre-processor directive* Or act like preprocessor. In the end it does the
same job as the C++ pre-processor does.
Not quite - because there's no separate pre-processor step.
So my question is, How can I get the C# code after compiler has done
processing this "pre-processor"?
It doesn't go from non-pre-processed code to pre-processed code.
There's no extra step.
As the C++ compiler has the facility to obtain the C++ code after compiler
has done pre-processing.


That's because C++ has a pre-processor. C# doesn't.

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

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

Similar topics

24
40102
by: Nudge | last post by:
I have an array, and an unrolled loop which looks like this: do_something(A); do_something(A); .... do_something(A); I thought: why should I type so much? I should write a macro. So I was looking to write something along the lines of:
16
4477
by: Trying_Harder | last post by:
Is it possible to redefine a macro with global scope after undefining it in a function? If yes, could someone explain how? /If/ my question above isn't very clear you can refer to the following example. eg cosider 2 files sample.c and sample.h sample.h
3
3135
by: Charlie Zender | last post by:
Hi, I want to have a CPP macro that tests the value of a token and returns the string "No" if the token is undefined (or 0) and returns "Yes" if the token is defined (non-zero). Then I can have C code that self-diagnoses its configuration with, e.g., #define TKN2YESNO(x) ((x)==0 ? ("No"):("Yes"))
0
1165
by: | last post by:
Hi, I want to find out how much time is spent in macro-code, without having to change all macro-definitions to include some tracking code. Thus when compiling a file, the preprocessor would (during macro-expansion), add some extra code, to make it easier to see at runtime (using some profiling tool) how often certain macro's were used. For...
3
1496
by: micromysore | last post by:
Hi, I want to post some code which has defn like struct AVPicture { int *data; int linesize; } the is noe recognised by matlab, so i need to port to some form like struct AVPicture { int **data;
2
6628
by: Paolo | last post by:
I imported a VC++6.0 project into VC++7.1. The conversion operation makes a mess with Preprocessor Definitions, adding a "$(NoInherit)" for each file. For example: I had a DLL project in VC++6.0 where the definitions were: _UNICODE,_DEBUG,_WIN32_DCOM,WIN32,_WINDOWS,_WINDLL,_AFXDLL,_USRDLL In VC++7.1, these are the preprocessor definitions...
8
2904
by: claus.tondering | last post by:
I need to write a macro that inserts someStruct m_someStruct; into another struct declaration. The problem is that if the programmer specifies one particluar struct (called alpha), nothing should be inserted. So, is it possible to write a macro that does this: MACRO(alpha) expands to nothing
6
2002
by: Subra | last post by:
Hi, Compilation of the below code fails #define a this1, /* Comma is intentional line 1*/ #define fun( x, y, z) y*x*z/*line 2*/ char this1,b,c;/*line 3*/
3
2029
by: qianz99 | last post by:
Hi I am not sure what this code does. I have the following questions 1. where is the case? 2. #define TLV_INTEGER(name, octets) p->name = -1; Is it define a function TLV_INTEGER(name, octets) and return a -1? and similar questions on other #define 3. in #define PDU(name, id, fields) \
0
7693
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8117
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7962
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6275
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5498
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2101
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 we have to send another system
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
932
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.