Results 1 to 5 of 5

Thread: Pre-processor macros?

  1. #1

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Pre-processor macros?

    Dear MS boffins:
    Hypothetically speaking, how feasible do you think it would be for future versions of .net languages to have something equivalent to pre-processor macros, the likes of which are seen in C/C++?

    I make extremely heavy use of them in my non-dotnet projects and my only real criticism of C#/VB is that they lack such a powerful coding aid, (otherwise it's terriffic).

    I think VB and C# are similar enough to C++ now to permit such a feature, so why not?

    Some reasons I thought about for not having them are as follows:
    - Marketing reasons, maybe it would bring VB/C# too close to C++ to be of any benefit.
    - it would screw up or slow down intellisense too much.
    - Only a weirdo would want such a thing.

    If it would be impractical to build it into the languages as standard, would it be something that could be implemented as an IDE plugin by a third party developer? Would the IDE bindings as they stand permit such an invasive code maniplation tool?

    Discuss
    Last edited by wossname; Dec 11th, 2007 at 07:49 AM.
    I don't live here any more.

  2. #2
    Interweb adm/o/distrator Paul M's Avatar
    Join Date
    Nov 2006
    Location
    Australia, Melbourne
    Posts
    2,306

    Re: Pre-processor macros?

    C# does have some preprocessor directives (not 100% sure about VB.NET), nothing like C/C++ but they have them

  3. #3

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Pre-processor macros?

    It's not even remotely close in terms of capability. I do use them for conditional compilation but that actually doesn't make programming any easier really, which is the sole point of prepro macros in the first place.
    I don't live here any more.

  4. #4
    Interweb adm/o/distrator Paul M's Avatar
    Join Date
    Nov 2006
    Location
    Australia, Melbourne
    Posts
    2,306

    Re: Pre-processor macros?

    Yea they are a lot less capable than those in C/C++, oh and it appears VB.NET has some of the directives also.

    Also i am not to sure about this but it appears you can use the C++ preprocessor if you want to on your C# files?

  5. #5

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Pre-processor macros?

    Not sure what you mean by that. A common practice is to get a C program to use its preprocessor to generate a C# code file so you save yourself a whole lot of legwork. That is fine as far as it goes. The best use of that is where you have a large list of constants that are shared between two platforms (say unix vs. windows) and they must correlate perfectly, such things are prone to human error so macros are a great help here.

    Having to rely on a separate C/C++ processor during a C# build can get quite fiddly and hard to document, hence my inquiry about this.
    I don't live here any more.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width