Wednesday, November 28, 2007

Jhoos Download Location


Thank you for visiting Jhoos Dating Messenger Website.

Jhoos messenger is currently available for Windows XP/2000 and Windows Vista.
Visit here to download Jhoos Messenger

- Jhoos Support

You have received this e-mail since you visited www.jhoos.com and requested to download the Jhoos Messenger.
If you do not wish to receive any e-mails from Jhoos please visit here.

SabitaR wants to Share Favorites with you

StumbleUpon

Discover new web sites

SabitaR wants to Share her Favorites with you

She has 1 fan

Come see why The Wall Street Journal says:

"Next time you want to wander the Web, forget about Googling it. Stumble it."

– SabitaR
sabitaparida@gmail.com

Try StumbleUpon >

About StumbleUpon
StumbleUpon allows you to channel surf the internet and discover great websites and web content you might never have found. Whether it's a website, video, picture, game, blog, or wiki, StumbleUpon helps you find interesting stuff recommended by like-minded people with just a single click of the Stumble! button. Learn More

If you do not wish to receive future e-mail invitations to join StumbleUpon, please click here.

© StumbleUpon 2001-2007

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to Cpp-Programming@googlegroups.com
To unsubscribe from this group, send email to Cpp-Programming-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/Cpp-Programming?hl=en
-~----------~----~----~----~------~----~------~--~---

Tuesday, November 27, 2007

Re: C++ Globals Registry Problem

On Nov 27, 2007 9:32 PM, BlueRaja <blueraja.admin@gmail.com> wrote:
> > And because the destructor is a function (technically) I could just
> > throw a function pointer to the destructor, right?
>
> No; the destructor is a method (member function), which means it needs a
> 'this' pointer in order to know what to deallocate. Since your registry
> does not keep track of the object-instances themselves, you would have no
> way of specifying the object to destruct.
>
> The suggestion given by the article you linked was to create a static method
> for each static ("global") variable; it is this method which will call the
> destructor of the object, and this method which you will pass as a reference
> to your 'registry.'

Ah, yes, I had forgotten that static objects don't really exist. They
can have static members, but they're not really static, so having a
constructor/destructor is rather inappropriate.

I learned that all in Java, it's coming back to me now... slowly :)

--
Registered Linux Addict #431495
http://profile.xfire.com/mrstalinman
John 3:16!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to Cpp-Programming@googlegroups.com
To unsubscribe from this group, send email to Cpp-Programming-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/Cpp-Programming?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: C++ Globals Registry Problem

> And because the destructor is a function (technically) I could just
> throw a function pointer to the destructor, right?

No; the destructor is a method (member function), which means it needs a 'this' pointer in order to know what to deallocate.  Since your registry does not keep track of the object-instances themselves, you would have no way of specifying the object to destruct.

The suggestion given by the article you linked was to create a static method for each static ("global") variable; it is this method which will call the destructor of the object, and this method which you will pass as a reference to your 'registry.'

Hope that helps.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to Cpp-Programming@googlegroups.com
To unsubscribe from this group, send email to Cpp-Programming-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/Cpp-Programming?hl=en
-~----------~----~----~----~------~----~------~--~---

Did you get my invite?

Hi,

Please join me

Re: C++ Globals Registry Problem

On Nov 27, 2007 4:26 PM, BlueRaja <blueraja.admin@gmail.com> wrote:
> Hello,
> Typically when you need a LIFO (Last-in First-out) data-structure, you'll
> use a stack (which, yes, can be implemented using a linked list, although
> you'll probably just want to use the STL class).
> I would simply push the function pointers onto the stack as they come, and
> when it comes time to clean up, pop them all and call the functions in that
> order.

And because the destructor is a function (technically) I could just
throw a function pointer to the destructor, right?

> As for your questions:
> 1. Yes, iSize is a typo, it should be eSize.

I thought so, but I wasn't entirely certain, so I asked. That's the
problem with some of these tutorials... they assume you've already
included things that make strange #define's or typedefs that make
little sense unless you're familiar with the context.

> 2. This syntax:
> Registry() : iIndex(0) {}
> is called an initialization list. You may use it to call an explicit base
> constructor, but it can also be used to initialize member variables. Since
> iIndex is an int, the code above is simply shorthand for
> Registry() { iIndex = 0; }
> If, however, iIndex were an instance of an object, the above code is
> actually preferred because it prevents the compiler from calling the
> object's default constructor first.

That makes sense.

> As for the enum, there is no real point that I know of - it should have the
> exact same effect as
> const int iSize = 16;
> with the added bonus that no one mixes up iSize and eSize ;)

Hah, thanks!

--
Registered Linux Addict #431495
http://profile.xfire.com/mrstalinman
John 3:16!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to Cpp-Programming@googlegroups.com
To unsubscribe from this group, send email to Cpp-Programming-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/Cpp-Programming?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: C++ Globals Registry Problem

Hello,
  Typically when you need a LIFO (Last-in First-out) data-structure, you'll use a stack (which, yes, can be implemented using a linked list, although you'll probably just want to use the STL class).
I would simply push the function pointers onto the stack as they come, and when it comes time to clean up, pop them all and call the functions in that order.

As for your questions:
1. Yes, iSize is a typo, it should be eSize.
2. This syntax:
  Registry() : iIndex(0) {}
is called an initialization list.  You may use it to call an explicit base constructor, but it can also be used to initialize member variables.  Since iIndex is an int, the code above is simply shorthand for
  Registry() { iIndex = 0; }
If, however, iIndex were an instance of an object, the above code is actually preferred because it prevents the compiler from calling the object's default constructor first.

As for the enum, there is no real point that I know of - it should have the exact same effect as
  const int iSize = 16;
with the added bonus that no one mixes up iSize and eSize ;)

Hope that helps!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to Cpp-Programming@googlegroups.com
To unsubscribe from this group, send email to Cpp-Programming-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/Cpp-Programming?hl=en
-~----------~----~----~----~------~----~------~--~---

Fwd: C++ Globals Registry Problem

I sent this to Programmer's Avenue, however, no one is really talking
much over there... Strange, since that used to be a very active
group.

Perhaps if I ask the same question here I can get a response other than silence.


---------- Forwarded message ----------
From: Chris Miller <lordsauronthegreat@gmail.com>
Date: Nov 25, 2007 9:11 PM
Subject: C++ Globals Registry Problem
To: Programmer's Avenue <progav@googlegroups.com>


I think I may have a good one here.

I've been building my game in C++, since Java is just too difficult to
make work (threading issues with Java AWT rendering, I wasn't about to
rewrite AWT, long story).

So I get to the problem of my global objects, since I can make them in
the right order, but tearing them down is different. I'd like to use
this nifty trick I found at
http://www.cs.utexas.edu/~downing/publications/Globals-JOOP-1996.pdf,
called a registry, which keeps track of the globals in order that they
were created, and tears them down in reverse order. C++ is hard
enough, I'm trying to be extra-sure I have code I can work with in the
long run, since I love this project, and I want it to be the best it
can be. Anyways, I guess I'm just saying I'm trying to maintain an
even higher standard to excellence for this one.

So I understand most of the registry, and I also get that it has a
limit of 16 items to begin with, and cannot grow (it uses the assert()
function to ensure this). I want to re-write this to use an STL
datatype (a vector, though I think it'd be best done in a linked list;
I have yet to pick the data structure, I just know I need something
more than an array).

However, I don't understand all of the device. I'll annotate it to
point out the bits I don't understand, so if you could help, I'd
really appreciate it.

// ----------
// Registry.h
// ----------
class Registry {
public:
Registry() :
iIndex(0) {

Where did the : iIndex(0) come from? I thought that meant extending a
constructor from a base class. I'm unfamiliar with that, what does it
do?

// initialize the function-pointer array
for (int i = 0; i < iSize; i++)
aFunctions[i] = 0;

Where did iSize come from? I only see i, eSize (from the struct) and
iIndex in scope. Is this an error?

}
~Registry() {
// invoke the vDestroy methods in reverse
for (int i = iIndex - 1; i &= 0; i--)
(*aFunctions[i])();
}
// declare a class static pointer for the Registry
static Registry* pTheRegistry;
private:
// define a typedef for the vDestroy methods
typedef void (*FP)();
public:
// define a method to store the function pointers
static void vStore(FP pFunction) {
assert(iIndex < eSize);
aFunctions[iIndex++] = pFunction;
}
private:
// define the size of the array
enum {eSize = 16};

Only one question: why put it inside an enumeration?

// define an index into the array
int iIndex;
// define the function-pointer array
FP aFunctions[eSize];};

I'm looking to replace that with another data structure that can grow
dynamically, however, I want to understand the original code before
mangling it.

// ----------
// Registry.c
// ----------
#include "Registry.h"
// define the class static pointer for the Registry
Registry* Registry::pTheRegistry;

And that I understand. I've been using Google pretty diligently, but
there are a few things I'm hung up on and would appreciate some more
experienced people showing me a few ropes.

Thanks in advance!

--
Registered Linux Addict #431495
http://profile.xfire.com/mrstalinman
John 3:16!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "C++ Programming" group.
To post to this group, send email to Cpp-Programming@googlegroups.com
To unsubscribe from this group, send email to Cpp-Programming-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/Cpp-Programming?hl=en
-~----------~----~----~----~------~----~------~--~---

Saturday, November 24, 2007

Jhoos Download Location


Thank you for visiting Jhoos Dating Messenger Website.

Jhoos messenger is currently available for Windows XP/2000 and Windows Vista.
Visit here to download Jhoos Messenger

- Jhoos Support

You have received this e-mail since you visited www.jhoos.com and requested to download the Jhoos Messenger.
If you do not wish to receive any e-mails from Jhoos please visit here.

Monday, November 19, 2007

Jhoos Download Location


Thank you for visiting Jhoos Dating Messenger Website.

Jhoos messenger is currently available for Windows XP/2000 and Windows Vista.
Visit here to download Jhoos Messenger

- Jhoos Support

You have received this e-mail since you visited www.jhoos.com and requested to download the Jhoos Messenger.
If you do not wish to receive any e-mails from Jhoos please visit here.

Wednesday, November 14, 2007

Jhoos Download Location


Thank you for visiting Jhoos Dating Messenger Website.

Jhoos messenger is currently available for Windows XP/2000 and Windows Vista.
Visit here to download Jhoos Messenger

- Jhoos Support

You have received this e-mail since you visited www.jhoos.com and requested to download the Jhoos Messenger.
If you do not wish to receive any e-mails from Jhoos please visit here.

Tuesday, November 13, 2007

Jhoos Download Location


Thank you for visiting Jhoos Dating Messenger Website.

Jhoos messenger is currently available for Windows XP/2000 and Windows Vista.
Visit here to download Jhoos Messenger

- Jhoos Support

You have received this e-mail since you visited www.jhoos.com and requested to download the Jhoos Messenger.
If you do not wish to receive any e-mails from Jhoos please visit here.

Friday, November 09, 2007

Jhoos Download Location


Thank you for visiting Jhoos Dating Messenger Website.

Jhoos messenger is currently available for Windows XP/2000 and Windows Vista.
Visit here to download Jhoos Messenger

- Jhoos Support

You have received this e-mail since you visited www.jhoos.com and requested to download the Jhoos Messenger.
If you do not wish to receive any e-mails from Jhoos please visit here.

Tuesday, November 06, 2007

Jhoos Download Location


Thank you for visiting Jhoos Dating Messenger Website.

Jhoos messenger is currently available for Windows XP/2000 and Windows Vista.
Visit here to download Jhoos Messenger

- Jhoos Support

You have received this e-mail since you visited www.jhoos.com and requested to download the Jhoos Messenger.
If you do not wish to receive any e-mails from Jhoos please visit here.

Friday, November 02, 2007

Jhoos Download Location


Thank you for visiting Jhoos Dating Messenger Website.

Jhoos messenger is currently available for Windows XP/2000 and Windows Vista.
Visit here to download Jhoos Messenger

- Jhoos Support

You have received this e-mail since you visited www.jhoos.com and requested to download the Jhoos Messenger.
If you do not wish to receive any e-mails from Jhoos please visit here.