Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Why C# doesn't have macro like C++

Why C# doesn't have macro like C++

Scheduled Pinned Locked Moved C#
csharpc++question
8 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gopal_Kanchana
    wrote on last edited by
    #1

    is it C# support macro like c++? if not Why ? is it any standard they are following. In C++ we can do MUL(X,Y) X*Y like this.

    D L realJSOPR D 4 Replies Last reply
    0
    • G Gopal_Kanchana

      is it C# support macro like c++? if not Why ? is it any standard they are following. In C++ we can do MUL(X,Y) X*Y like this.

      D Offline
      D Offline
      DaveyM69
      wrote on last edited by
      #2

      See this MSDN blog[^]

      Dave
      BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
      Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)

      G 1 Reply Last reply
      0
      • G Gopal_Kanchana

        is it C# support macro like c++? if not Why ? is it any standard they are following. In C++ we can do MUL(X,Y) X*Y like this.

        L Offline
        L Offline
        Lev Danielyan
        wrote on last edited by
        #3

        These are different languages, with different features, that's it. This question is kinda like a holywar starter :)

        Regards, Lev

        G 1 Reply Last reply
        0
        • G Gopal_Kanchana

          is it C# support macro like c++? if not Why ? is it any standard they are following. In C++ we can do MUL(X,Y) X*Y like this.

          realJSOPR Offline
          realJSOPR Offline
          realJSOP
          wrote on last edited by
          #4
          1. Just because you *can* do something in C++, doesn't mean you should. 1) Macros can be used to circumvent the strong typing requirements of C++. Side effects are possible, and that's bad. 2) Macros cannot be debugged. Macros that contain code are evil and should be avoided whenever possible.

          "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
          -----
          "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

          J 1 Reply Last reply
          0
          • L Lev Danielyan

            These are different languages, with different features, that's it. This question is kinda like a holywar starter :)

            Regards, Lev

            G Offline
            G Offline
            Gopal_Kanchana
            wrote on last edited by
            #5

            Thanks for your reply

            1 Reply Last reply
            0
            • D DaveyM69

              See this MSDN blog[^]

              Dave
              BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
              Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)

              G Offline
              G Offline
              Gopal_Kanchana
              wrote on last edited by
              #6

              Thanks. this is a exact link.

              1 Reply Last reply
              0
              • realJSOPR realJSOP
                1. Just because you *can* do something in C++, doesn't mean you should. 1) Macros can be used to circumvent the strong typing requirements of C++. Side effects are possible, and that's bad. 2) Macros cannot be debugged. Macros that contain code are evil and should be avoided whenever possible.

                "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                -----
                "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

                J Offline
                J Offline
                Jon Rista
                wrote on last edited by
                #7

                Have to agree on all points. Macros are about the most evil feature C/C++ have to offer. The looong, late, sleepless nights dealing with macro expansion bugs...what a night terror. All I can say is, THANK GOD C# doesn't have macros!! :D

                1 Reply Last reply
                0
                • G Gopal_Kanchana

                  is it C# support macro like c++? if not Why ? is it any standard they are following. In C++ we can do MUL(X,Y) X*Y like this.

                  D Offline
                  D Offline
                  Dave Doknjas
                  wrote on last edited by
                  #8

                  Using macros, you can redesign your coding 'language' on the fly until your code doesn't even remotely look like C++. If you've seen as much bad C++ as I have, you know why many consider macros evil.

                  David Anton http://www.tangiblesoftwaresolutions.com C++ to C# Converter C++ to VB Converter C++ to Java Converter VB & C# to Java Converter Java to VB & C# Converter Instant C#: VB to C# converter Instant VB: C# to VB converter Instant C++: convert VB, C#, or Java to C++

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups