Thread: unions

Results 1 to 6 of 6
  1. #1
    whit's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    7,159
    Reputation
    490
    Thanks
    2,253

    unions

    Does anyone Active use them in your code ?
    I personally have not found a reason to use them

    /Discuss

  2. #2
    .::SCHiM::.'s Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    733
    Reputation
    180
    Thanks
    880
    My Mood
    Twisted
    Quote Originally Posted by whit View Post
    Does anyone Active use them in your code ?
    I personally have not found a reason to use them

    /Discuss
    I only use unions when working in the kernel or when I'm building a driver, and that's just because the os uses them when working with LARGE_INTEGERS and other such data types. You can divide the LARGE_INTEGER (int64) in two parts (Low and High) without wasting memory using unions.

    I'm SCHiM

    Morals derive from the instinct to survive. Moral behavior is survival behavior above the individual level.

    Polymorphic engine
    Interprocess callback class
    SIN
    Infinite-precision arithmetic
    Hooking dynamic linkage
    (sloppy)Kernel mode Disassembler!!!

    Semi debugger




  3. The Following User Says Thank You to .::SCHiM::. For This Useful Post:

    whit (06-12-2011)

  4. #3
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    I've only ever used unions twice, both times were for structures related to my PE parser, in terms of using them in my own personal code, can't say I've ever really needed them

  5. The Following User Says Thank You to Jason For This Useful Post:

    whit (06-12-2011)

  6. #4
    whit's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    7,159
    Reputation
    490
    Thanks
    2,253
    I personally never used one..I feel unloved

  7. #5
    Auxilium's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    深い碧の果てに
    Posts
    4,518
    Reputation
    445
    Thanks
    609
    My Mood
    Happy
    i've used unions...once..

  8. The Following User Says Thank You to Auxilium For This Useful Post:

    whit (06-13-2011)

  9. #6
    freedompeace's Avatar
    Join Date
    Jul 2010
    Gender
    female
    Posts
    3,033
    Reputation
    340
    Thanks
    2,792
    My Mood
    Sad
    union
    {
    int16
    int32
    int64
    }

    The only use I've found for unions.

  10. The Following User Says Thank You to freedompeace For This Useful Post:

    whit (06-13-2011)