Probably a stupid question, but still: Why do you even have that Null class?
You should never let your fears become the boundaries of your dreams.
Mini Challenge
You should never let your fears become the boundaries of your dreams.
It solves the problem of overloading on pointers and numeric types. I don''t think this is a problem in this application, but the Null class is just something I include by default.
As an example of the problem:
Now if null is defined as:
or:
a call to:
calls the int version, when the object* version was probably wanted.
You can try and solve it by declaring:
since a conversion from long to pointer is considered by the standard to be no worse than a conversion from long to int, so at least the call become ambiguous, but what if you have:
Now you''re back to calling the wrong function.
You could try:
But now you have to cast the null to pass it to a function.
The null class solves all these problems. It has no conversion to any built-in type, so it is not ambiguous, but it has a conversion to any pointer type (you can extend it to add pointer-to-member types), so no casting is required. For more information find a copy of Effective C++.
Enigma
As an example of the problem:
class Problem{ public: void overload(int i); void overload(object* o);}
Now if null is defined as:
#define null 0
or:
const int null = 0;
a call to:
problemInstance.overload(null);
calls the int version, when the object* version was probably wanted.
You can try and solve it by declaring:
#define null 0L
since a conversion from long to pointer is considered by the standard to be no worse than a conversion from long to int, so at least the call become ambiguous, but what if you have:
class Problem{ public: void overload(long l); void overload(object* o);}
Now you''re back to calling the wrong function.
You could try:
const void* null = 0;
But now you have to cast the null to pass it to a function.
The null class solves all these problems. It has no conversion to any built-in type, so it is not ambiguous, but it has a conversion to any pointer type (you can extend it to add pointer-to-member types), so no casting is required. For more information find a copy of Effective C++.
Enigma
I''d be interested but your links don''t work.
Oh yeah, i know it''s kind of late but i could make something in 1 day.
Oh yeah, i know it''s kind of late but i could make something in 1 day.
It looks like my hosts are down at the moment. Hopefully they'll be back up soon (they're usually very reliable). In the mean time, if you want to take part I can e-mail the stuff to you - just post your e-mail and whether you want the vc .net version or the normal version. If you don't want to post your e-mail address, you can e-mail me at Paul_Kitchin@yahoo.com.
Enigma
EDIT: typo
[edited by - Enigma on February 13, 2004 3:15:49 PM]
Enigma
EDIT: typo
[edited by - Enigma on February 13, 2004 3:15:49 PM]
I would like to see it and possibly give it a try. dan@gmg.com. Although I don't use vc 6 or vc .net, I am on Linux (can build windows if I need though).
Nevermind, this looks pretty windows specific after reviewing other posts. Sorry, I am an idiot.
Edit: Stupidity
[edited by - clutch on February 13, 2004 6:41:47 PM]
Nevermind, this looks pretty windows specific after reviewing other posts. Sorry, I am an idiot.
Edit: Stupidity
[edited by - clutch on February 13, 2004 6:41:47 PM]
It''s not completely windows specific. The skeleton uses glut, so it should be cross-platform. The only requirement is that I need to ba able to run your entry, which means either a windows executable or source code that I can compile under windows. Let me know if you''re still interested (or just grab the download, I think my host is up again).
Enigma
Enigma
k, if i finish this time heres what the paddle will look like:

...he packs a mean punch. As of now i have him done, and all of the animations i intend to use in the program as well as a model importrer. That and a particle engine are going to be about all you''ll see from my demo...i''ll see what else i can add with the hours that remain.
Heres hoping i finish...

...he packs a mean punch. As of now i have him done, and all of the animations i intend to use in the program as well as a model importrer. That and a particle engine are going to be about all you''ll see from my demo...i''ll see what else i can add with the hours that remain.
Heres hoping i finish...

No way I could have anything ready at the end of the contest at this point, got stuck with three assignments AND it is valentines day. Being a married old fart, it is important to keep the wife happy. Remember, once you get married, keep the woman happy, it turns out your happiness depends on hers!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement