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 / C++ / MFC
  4. global anonymous unions

global anonymous unions

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++help
15 Posts 5 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.
  • T toxcct

    why using an anonymous union ? just give it a name !!

    extern union myUnion {
    int x;
    int y;
    };


    TOXCCT >>> GEII power
    [toxcct][VisualCalc 2.20][VisualCalc 3.0] -- modified at 4:18 Tuesday 20th December, 2005

    V Offline
    V Offline
    vikas amin
    wrote on last edited by
    #5

    Yeh TOXCCT Giving a name is good. but an anonymous union also dont create any issue , i tired and checked it out in my project. It works fine . Vikas Amin Embin Technology Bombay vikas.amin@embin.com

    1 Reply Last reply
    0
    • T toxcct

      why using an anonymous union ? just give it a name !!

      extern union myUnion {
      int x;
      int y;
      };


      TOXCCT >>> GEII power
      [toxcct][VisualCalc 2.20][VisualCalc 3.0] -- modified at 4:18 Tuesday 20th December, 2005

      E Offline
      E Offline
      Eytukan
      wrote on last edited by
      #6

      where is the name??? did u mean extern union myUnion { int x; int y; }mu; is this ok?


      "But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho

      --[V]--

      T 1 Reply Last reply
      0
      • E Eytukan

        where is the name??? did u mean extern union myUnion { int x; int y; }mu; is this ok?


        "But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho

        --[V]--

        T Offline
        T Offline
        toxcct
        wrote on last edited by
        #7

        the name is in bold !!! but you're right, i forgot either a typedef or a 1st name ;) fixed now.


        TOXCCT >>> GEII power
        [toxcct][VisualCalc 2.20][VisualCalc 3.0]

        E 1 Reply Last reply
        0
        • T toxcct

          the name is in bold !!! but you're right, i forgot either a typedef or a 1st name ;) fixed now.


          TOXCCT >>> GEII power
          [toxcct][VisualCalc 2.20][VisualCalc 3.0]

          E Offline
          E Offline
          Eytukan
          wrote on last edited by
          #8

          mon cher ami, ca va? je fais bein ici. (ok lets not squeeze my brain to get those french words out :doh:) how's chirstmas preparations going on? is it full of snow? you ski? skate? spend lot of time with your coupine?? what's going to be your gift for her this xmas???


          "But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho

          --[V]--

          T 1 Reply Last reply
          0
          • E Eytukan

            mon cher ami, ca va? je fais bein ici. (ok lets not squeeze my brain to get those french words out :doh:) how's chirstmas preparations going on? is it full of snow? you ski? skate? spend lot of time with your coupine?? what's going to be your gift for her this xmas???


            "But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho

            --[V]--

            T Offline
            T Offline
            toxcct
            wrote on last edited by
            #9

            VivekuniQ wrote:

            mon cher ami,

            pas trop mal, merci :rolleyes:

            VivekuniQ wrote:

            ok lets not squeeze my brain to get those french words out

            that was not so bad,, except the little "je fais bien" instead of "je vais bien", but nevermind.

            VivekuniQ wrote:

            how's chirstmas preparations going on ?

            full of work !!! :laugh: actually, i'm still working until late friday evening, but i took time to buy some presents to my mum (who comes to see me and celebrate Xmas with us this year - she have to come accross 800kms to get here !), my sweet girlfriend and all her family in which i will pass the date (sisters, parents, boyfriends of her sisters too - which have the same first name as mine !! :-D what a coincidence !)

            VivekuniQ wrote:

            is it full of snow?

            not where i am actually... i love snow, i love skiing, but i am near the atlantic (Nantes i you know), and snow if quite rare out there...

            VivekuniQ wrote:

            spend lot of time with your coupine??

            hum, not that much, but i'd like to !!! it's hard to find the time to spend with her when i work hard all the day, when she also have to study hard for her exam on january, and when we don't even live together during the week !! :(( but hey, it's hard now to be better latter, isn't it ? :-D

            VivekuniQ wrote:

            what's going to be your gift for her this xmas???

            i doubt that she looks at CodeProject (actually, she hate it :laugh: ) but i cannot take the risk to write it there before Christmas... sorry :cool: now, i hope you having a good time too... Merry Christmas dear Vivek. see you - On CP naturally...


            TOXCCT >>> GEII power
            [toxcct][VisualCalc 2.20][VisualCalc 3.0]

            T 1 Reply Last reply
            0
            • T toxcct

              VivekuniQ wrote:

              mon cher ami,

              pas trop mal, merci :rolleyes:

              VivekuniQ wrote:

              ok lets not squeeze my brain to get those french words out

              that was not so bad,, except the little "je fais bien" instead of "je vais bien", but nevermind.

              VivekuniQ wrote:

              how's chirstmas preparations going on ?

              full of work !!! :laugh: actually, i'm still working until late friday evening, but i took time to buy some presents to my mum (who comes to see me and celebrate Xmas with us this year - she have to come accross 800kms to get here !), my sweet girlfriend and all her family in which i will pass the date (sisters, parents, boyfriends of her sisters too - which have the same first name as mine !! :-D what a coincidence !)

              VivekuniQ wrote:

              is it full of snow?

              not where i am actually... i love snow, i love skiing, but i am near the atlantic (Nantes i you know), and snow if quite rare out there...

              VivekuniQ wrote:

              spend lot of time with your coupine??

              hum, not that much, but i'd like to !!! it's hard to find the time to spend with her when i work hard all the day, when she also have to study hard for her exam on january, and when we don't even live together during the week !! :(( but hey, it's hard now to be better latter, isn't it ? :-D

              VivekuniQ wrote:

              what's going to be your gift for her this xmas???

              i doubt that she looks at CodeProject (actually, she hate it :laugh: ) but i cannot take the risk to write it there before Christmas... sorry :cool: now, i hope you having a good time too... Merry Christmas dear Vivek. see you - On CP naturally...


              TOXCCT >>> GEII power
              [toxcct][VisualCalc 2.20][VisualCalc 3.0]

              T Offline
              T Offline
              ThatsAlok
              wrote on last edited by
              #10

              toxcct wrote:

              Merry Christmas

              Merry Christmas ..... I hope that bring good thing to your life

              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

              cheers, Alok Gupta VC Forum Q&A :- I/ IV

              V E 2 Replies Last reply
              0
              • T ThatsAlok

                toxcct wrote:

                Merry Christmas

                Merry Christmas ..... I hope that bring good thing to your life

                "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                cheers, Alok Gupta VC Forum Q&A :- I/ IV

                V Offline
                V Offline
                vikas amin
                wrote on last edited by
                #11

                its g8 that u can see ur parents in christmas people like me have to wait for years to stay with parents. Vikas Amin Embin Technology Bombay vikas.amin@embin.com

                E 1 Reply Last reply
                0
                • T ThatsAlok

                  toxcct wrote:

                  Merry Christmas

                  Merry Christmas ..... I hope that bring good thing to your life

                  "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                  cheers, Alok Gupta VC Forum Q&A :- I/ IV

                  E Offline
                  E Offline
                  Eytukan
                  wrote on last edited by
                  #12

                  ThatsAlok wrote:

                  I hope that bring good thing to your life

                  i'll be really happy if life brings somethingchristmas gift from mr.Alok!!:-D:cool:

                  ThatsAlok wrote:

                  Merry Christmas .....

                  Merry Merry christmas!!:-O :jig: -vivek


                  "But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho

                  --[V]--

                  T 1 Reply Last reply
                  0
                  • V vikas amin

                    its g8 that u can see ur parents in christmas people like me have to wait for years to stay with parents. Vikas Amin Embin Technology Bombay vikas.amin@embin.com

                    E Offline
                    E Offline
                    Eytukan
                    wrote on last edited by
                    #13

                    happy christmas to you too man :) , where do ur parents live?? faraway??


                    "But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho

                    --[V]--

                    1 Reply Last reply
                    0
                    • V vikas amin

                      Hey man what was the problem i didnot get any reply i have tired it with my vc6 compiler it works fine with my program . I dont seeem any problem in it :cool: Vikas Amin Embin Technology Bombay vikas.amin@embin.com

                      Z Offline
                      Z Offline
                      zildjohn01
                      wrote on last edited by
                      #14

                      the problem is i can only use one storage-class specifier, but static is required so i can't use extern. this current method works fine if i only need to access it through one source file, but my project has many source files and requires the members of this union to be accessed through many of those files. here is my current code, please post yours that works: // main.h extern union {int y; int z;}; // test.cpp #include "main.h" void do_something() { y = z; } // main.cpp static union {int y; int z;}; void main() { do_something(); } i appreciate it, John

                      1 Reply Last reply
                      0
                      • E Eytukan

                        ThatsAlok wrote:

                        I hope that bring good thing to your life

                        i'll be really happy if life brings somethingchristmas gift from mr.Alok!!:-D:cool:

                        ThatsAlok wrote:

                        Merry Christmas .....

                        Merry Merry christmas!!:-O :jig: -vivek


                        "But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho

                        --[V]--

                        T Offline
                        T Offline
                        ThatsAlok
                        wrote on last edited by
                        #15

                        VivekuniQ wrote:

                        Merry Merry christmas!!

                        Yeap Marry Christmas :)...

                        VivekuniQ wrote:

                        somethingchristmas gift from mr.Alok

                        Hai... Today is D Day for me.. :).

                        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                        cheers, Alok Gupta VC Forum Q&A :- I/ IV

                        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