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. Specifying data segment for instances of a class

Specifying data segment for instances of a class

Scheduled Pinned Locked Moved C / C++ / MFC
helpcomsalesquestion
1 Posts 1 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.
  • C Offline
    C Offline
    Code o mat
    wrote on last edited by
    #1

    Hello folks! I am using this[^] method to control the initialization order of some global objects. I have (plans for) a class that will be instantiated all around the code, all instances will be globals, i was wondering, is there maybe a way to specify that i want all instances of this class instantiated in a given segment so i don't have to use

    #pragma init_seg("aseg$x", some_method);
    CIWantThisInSegX whatevera;
    CIWantThisInSegX whateverb;

    everywhere and instead i can just create the instances and they will be placed in the correct segment "automatically"? Maybe by specifying a new operator for it? If it was possible it would help a lot because it is enough to forget the init_seg part only once and havoc might get loose. Thanks in advance for any ideas.

    > The problem with computers is that they do what you tell them to do and not what you want them to do. < > "It doesn't work, fix it" does not qualify as a bug report. < > Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <

    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