Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there something comparable to #pragma message?

Tags:

c#

pragma

I am working with a project that uses both c++ and c#. I've been working on a huge messy integration and have been making heavy use of #pragma message to call out code that isn't fully functional yet (broken as a result of the integration). This is a really nice way to clutter up the build log so it's easy to find things that need to be fixed up. The problem is that I can't find anything that will work the same way for c#.

I don't want to use the obsolete attribute, that's not at all what I'm looking for. I tried #warn, but that just generates a "warning as error" which fails the build. Again, not what I'm looking for (I could just use #error if I wanted to fail the build...).

For now I'm just putting my messages in comments that can be searched for, but this requires some knowledge of what to look for as well as the motivation to look for it. Calling issues out with a custom message in the build log is much preferable as it's hard to ignore!

My research leads me to believe that there isn't a way to do what I want but I wanted to see if you experts agree with me or not. :)

like image 724
thehelix Avatar asked May 12 '14 18:05

thehelix


People also ask

What does it mean to say something is comparable?

Definition of comparable 1 : capable of or suitable for comparison The situations are not at all comparable. 2 : similar, like fabrics of comparable quality The two houses are comparable in size.

How do you use comparable in a sentence?

A comparable refrigerator today would cost a lot more than the one I bought 10 years ago. The two houses are comparable in size. Their salaries are comparable with those of other managers.

Where is something compared to something else?

What is an analogy? An analogy is a comparison made to show how two different things are similar, especially in limited ways. An analogy is a technique frequently used in literature to explain something by comparing it to something else (a literary device).

How do you use comparable in Word?

Use comparable to describe two things that are alike. If you are offered two jobs with comparable salaries, you might take the one where the weather is nicer. Comparable can also mean exactly what it looks like: things you are “able” to “compare” are comparable.


2 Answers

I typically use the following code:

#warning //Todo Finish this method by....

#warning does not have to be treated as an error, it is configurable in each project under Project Configuration | Build Tab:

enter image description here

With the description in the warning the build log should look like the following:

enter image description here

Additionally, the //Todo comment will add the description to the built-in task list which allows you to distinguish between compiler warnings and user-set compiler warnings:

enter image description here

like image 165
Erik Philips Avatar answered Sep 20 '22 05:09

Erik Philips


#warning does exactly what you want: produce a compile warning. This does not fail the build.

Maybe you have the setting enabled to treat warnings as errors? This setting can be found on your Project Configuration | Build tab.

like image 31
MicroVirus Avatar answered Sep 19 '22 05:09

MicroVirus