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. Other Discussions
  3. The Weird and The Wonderful
  4. My introduction to "##"

My introduction to "##"

Scheduled Pinned Locked Moved The Weird and The Wonderful
careerhardwarequestion
24 Posts 10 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.
  • P peterchen

    I actually wanted to do that as a project to "learn XML", but just the basics were such a bumpy ride that I contracted some kind of XML allergy. So if you do: A R T I C L E ! ;)


    We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
    My first real C# project | Linkify!|FoldWithUs! | sighist

    P Offline
    P Offline
    PIEBALDconsult
    wrote on last edited by
    #21

    Wish granted, just submitted the article. (Now waiting for the tomatoes to start flying.)

    P 1 Reply Last reply
    0
    • P PIEBALDconsult

      Wish granted, just submitted the article. (Now waiting for the tomatoes to start flying.)

      P Offline
      P Offline
      peterchen
      wrote on last edited by
      #22

      Waiting for it to appear...


      We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
      My first real C# project | Linkify!|FoldWithUs! | sighist

      1 Reply Last reply
      0
      • T Todd_s02

        I was never one for the intricacies of the C preprocessor. On my latest project, apparently (or rather, unfortunately) someone is. An .h file has a bunch of definitions (real variable names changed to protect the innocent): statedefs.h: makeState(State1, 0x01) makeState(State2, 0x02) makeState(State3, 0x03) Odd, I think, but ok. Then I go look up "makeState". What the... 3 entries? That's not a good sign. Instance 1: #define makeState(NAME, NUM) ST_##NAME## = ##NUM##, typedef enum { #include "statedefs.h" ST_LAST } statetype; Instance 2: Embedded in the middle of a function(!) #undef makestate #define makeState(NAME, NUM) somevariable++; #include "statedefs.h" Instance 3: #define makestate(NAME, NUM) { "ST_"#NAME,0,0}, sometype stateinfo[] = { #include "statedefs.h" } There are no external programs being used, no weird autogeneration stuff.. the entire set of code is a replacement for: enum { ST_State1 = 1, ST_State2 = 2, ST_State3 = 3, ST_LAST } Most editors I've tried cannot tag it, due to the preprocessor concatenation used ("##" in instance 1). References don't work either. And this is one of the easier to read examples of preprocessor abuse... I just try and remind myself that code written this way makes it that much easier on my next job interview!

        K Offline
        K Offline
        KarstenK
        wrote on last edited by
        #23

        This looks like "Security through obscurity" or the writer of this code wants to write such mess. If this is the style of the writer he ist a danger for the company.X|

        Greetings from Germany

        1 Reply Last reply
        0
        • P PIEBALDconsult

          (He's probably the only one.)

          P Offline
          P Offline
          peterchen
          wrote on last edited by
          #24

          :laugh: Yeah, maybe.

          Agh! Reality! My Archnemesis![^]
          | FoldWithUs! | sighist | WhoIncludes - Analyzing C++ include file hierarchy

          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