I concurxiphirx wrote:Stopped reading there.Code: Select all
typedef std::vetcor<Instance> Vetcor;
Confusion
Moderator: Coders of Rage
- GroundUpEngine
- Chaos Rift Devotee
- Posts: 835
- Joined: Sun Nov 08, 2009 2:01 pm
- Current Project: mixture
- Favorite Gaming Platforms: PC
- Programming Language of Choice: C++
- Location: UK
Re: Confusion
Re: Confusion
You're really not understanding what people are asking are you?THe Floating Brain wrote:Beacuse I did not want to deal with pre-prosser commands
Why would you want your code to look this this?
Code: Select all
Instance MyClass {
};
Re: Confusion
I'm giving you a tip, man, just please... go through the fundamentals of C++ one more time, and this time, make sure you UNDERSTAND every concept and how to use it... or at least, please brush up on it.
I remember when I used to be into nostalgia.
- Ginto8
- ES Beta Backer
- Posts: 1064
- Joined: Tue Jan 06, 2009 4:12 pm
- Programming Language of Choice: C/C++, Java
Re: Confusion
also, please understand that a specific syntax is used by the language for a very specific reason. Using preprocessor to CHANGE the syntax of the language is like trying to chop off someone's legs just because you like midgets better.D-e-X wrote:I'm giving you a tip, man, just please... go through the fundamentals of C++ one more time, and this time, make sure you UNDERSTAND every concept and how to use it... or at least, please brush up on it.
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
Re: Confusion
^ this is true.Ginto8 wrote:also, please understand that a specific syntax is used by the language for a very specific reason. Using preprocessor to CHANGE the syntax of the language is like trying to chop off someone's legs just because you like midgets better.D-e-X wrote:I'm giving you a tip, man, just please... go through the fundamentals of C++ one more time, and this time, make sure you UNDERSTAND every concept and how to use it... or at least, please brush up on it.
I remember when I used to be into nostalgia.
Re: Confusion
What a genius way of putting it....Ginto8 wrote:also, please understand that a specific syntax is used by the language for a very specific reason. Using preprocessor to CHANGE the syntax of the language is like trying to chop off someone's legs just because you like midgets better.D-e-X wrote:I'm giving you a tip, man, just please... go through the fundamentals of C++ one more time, and this time, make sure you UNDERSTAND every concept and how to use it... or at least, please brush up on it.
- Ginto8
- ES Beta Backer
- Posts: 1064
- Joined: Tue Jan 06, 2009 4:12 pm
- Programming Language of Choice: C/C++, Java
Re: Confusion
crazy analogies are my specialtyN64vSNES wrote:What a genius way of putting it....Ginto8 wrote:also, please understand that a specific syntax is used by the language for a very specific reason. Using preprocessor to CHANGE the syntax of the language is like trying to chop off someone's legs just because you like midgets better.D-e-X wrote:I'm giving you a tip, man, just please... go through the fundamentals of C++ one more time, and this time, make sure you UNDERSTAND every concept and how to use it... or at least, please brush up on it.
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
Re: Confusion
Not to pick any sides, or say one way is better than the other, but you do sometimes see typedefs going on.
for instance, with returning function pointers it is a lot easier to do.
also, if you have ever dabbled in C, you would have probably had to typedef some of your structs. (well not had to, but i dont wanna write struct out every time i have to declare one.)
and then onto C++, you sometimes do see this aswell, usually to make things easier on the programmer, afterall, is that not what programming is about?
http://en.wikipedia.org/wiki/Typedef
"
"
for instance, with returning function pointers it is a lot easier to do.
Code: Select all
typedef float(*pFunc)(args, ...);
pFunc foo(args, ...);
Code: Select all
typedef struct
{
bla bla bla
} bla, *pBla;
and then onto C++, you sometimes do see this aswell, usually to make things easier on the programmer, afterall, is that not what programming is about?
http://en.wikipedia.org/wiki/Typedef
"
Code: Select all
std::vector<std::pair<std::string, int> > values;
for (std::vector<std::pair<std::string, int> >::const_iterator i = values.begin(); i != values.end(); ++i)
{
std::pair<std::string, int> const & t = *i;
// do something
}
Code: Select all
typedef std::pair<std::string, int> value_t;
typedef std::vector<value_t> values_t;
values_t values;
for (values_t::const_iterator i = values.begin(); i != values.end(); ++i)
{
value_t const & t = *i;
// do something
}
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
Dad, "Yea well I have a fan belt in street fighting"
- Ginto8
- ES Beta Backer
- Posts: 1064
- Joined: Tue Jan 06, 2009 4:12 pm
- Programming Language of Choice: C/C++, Java
Re: Confusion
typedef'ing is fine. It does not actually change the syntax of the language. However, renaming the KEYWORD "class" to "Instance" is not only unnecessary, clumsy, and downright bad programming, it also misleads people as to what a program actually does. A class is not an instance, and therefore should not be called one. Renaming "class" to "type" would be just as unnecessary and clumsy, but it would be less bad because it does not mislead whoever reads the code.
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
Re: Confusion
What he said^
Although I've used it for function pointers.
Although I've used it for function pointers.
- THe Floating Brain
- Chaos Rift Junior
- Posts: 284
- Joined: Tue Dec 28, 2010 7:22 pm
- Current Project: RTS possible Third Person shooter engine.
- Favorite Gaming Platforms: PC, Wii, Xbox 360, GAME CUBE!!!!!!!!!!!!!!!!!!!!!!
- Programming Language of Choice: C/C++, Python 3, C#
- Location: U.S
Re: Confusion
Well lots of talk on this while I was gone XD. Reason being for that is just to make it easier to take any instance of any class for a function argument (the implimentation for this is show in the topic post).
I am well aware that a class is not a instance. The purpose of this function is to feed a instance of a class into a element of a std::vector or a array.A class is not an instance, and therefore should not be called one.
I fully understand the fundamentals of C++, maybe im a little messy in my work but I do understand C++.I'm giving you a tip, man, just please... go through the fundamentals of C++ one more time, and this time, make sure you UNDERSTAND every concept and how to use it... or at least, please brush up on it.
Thank you avansc The whole reason for this typedef is simply to make things easier!usually to make things easier on the programmer, after all, is that not what programming is about?
I already explained that I was using that to test stuff (although agreed it is bad practices) and I forgot to take it out.GroundUpEngine wrote:I concurxiphirx wrote:Stopped reading there.Code: Select all
typedef std::vector<Instance> Vector;
How is that trolling?!?!?!xiphirx wrote:watTHe Floating Brain wrote:Because I did not want to deal with pre-prosser commands
are you a troll by chance?
"Why did we say we were going to say we were going to change the world tomorrow yesterday? Maybe you can." - Myself
Re: Confusion
Would you please listen to what people are saying? typedef's are there to make things easier but they're not to be abused.THe Floating Brain wrote:Well lots of talk on this while I was gone XD. Reason being for that is just to make it easier to take any instance of any class for a function argument (the implimentation for this is show in the topic post).I am well aware that a class is not a instance. The purpose of this function is to feed a instance of a class into a element of a std::vector or a array.A class is not an instance, and therefore should not be called one.I fully understand the fundamentals of C++, maybe im a little messy in my work but I do understand C++.I'm giving you a tip, man, just please... go through the fundamentals of C++ one more time, and this time, make sure you UNDERSTAND every concept and how to use it... or at least, please brush up on it.Thank you avansc The whole reason for this typedef is simply to make things easier!usually to make things easier on the programmer, after all, is that not what programming is about?I already explained that I was using that to test stuff (although agreed it is bad practices) and I forgot to take it out.GroundUpEngine wrote:I concurxiphirx wrote:Stopped reading there.Code: Select all
typedef std::vector<Instance> Vector;
How is that trolling?!?!?!xiphirx wrote:watTHe Floating Brain wrote:Because I did not want to deal with pre-prosser commands
are you a troll by chance?
To typedef a struct is perfectly understandable since it will make code easier to read.
To typedef a function pointer is fine they look like shit anyway.
To typedef the class keyword is just retarded.
Like I said before visual studio dosen't even approve of this:
Code: Select all
warning C4091: 'typedef ' : ignored on left of 'Instance' when no variable is declared
You shouldn't ignore your warnings. Remove this and you're one step closer to your program working properly.
- THe Floating Brain
- Chaos Rift Junior
- Posts: 284
- Joined: Tue Dec 28, 2010 7:22 pm
- Current Project: RTS possible Third Person shooter engine.
- Favorite Gaming Platforms: PC, Wii, Xbox 360, GAME CUBE!!!!!!!!!!!!!!!!!!!!!!
- Programming Language of Choice: C/C++, Python 3, C#
- Location: U.S
Re: Confusion
Very well then I will admit I do not exactly read up on format . Is a template okey instead of a typedef? Please dont yell at me .
P.s
P.s
Correct term is "Developmentaly Challanged" use of the word "retared" is outdated. (Have worked with poeple whom actualy have that realy sad ).To typedef the class keyword is just retarded.
"Why did we say we were going to say we were going to change the world tomorrow yesterday? Maybe you can." - Myself
- Ginto8
- ES Beta Backer
- Posts: 1064
- Joined: Tue Jan 06, 2009 4:12 pm
- Programming Language of Choice: C/C++, Java
Re: Confusion
The term is mental retardation. They're very stupid because either their brain is not fully developed or it just doesn't function correctly, but being "Developmentally Challenged" is ambiguous and definitely not descriptive enough. Please cut the PC bullshit here.
Also, the "any instance of any class" thing makes me think you're looking for polymorphism, or simply templating. Which it is, I can't tell, because your description is too vague and your understanding is obviously too little.
Also, the "any instance of any class" thing makes me think you're looking for polymorphism, or simply templating. Which it is, I can't tell, because your description is too vague and your understanding is obviously too little.
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
- THe Floating Brain
- Chaos Rift Junior
- Posts: 284
- Joined: Tue Dec 28, 2010 7:22 pm
- Current Project: RTS possible Third Person shooter engine.
- Favorite Gaming Platforms: PC, Wii, Xbox 360, GAME CUBE!!!!!!!!!!!!!!!!!!!!!!
- Programming Language of Choice: C/C++, Python 3, C#
- Location: U.S
Re: Confusion
It is the updated term (http://www.wordwebonline.com/en/DEVELOP ... CHALLENGED)(basicly a more polite version of the term) I do not want to start a fight so that is all I will say. Anyway moving onto softwere development.Ginto8 wrote:The term is mental retardation. They're very stupid because either their brain is not fully developed or it just doesn't function correctly, but being "Developmentally Challenged" is ambiguous and definitely not descriptive enough. Please cut the PC bullshit here.
Also, the "any instance of any class" thing makes me think you're looking for polymorphism, or simply templating. Which it is, I can't tell, because your description is too vague and your understanding is obviously too little.
The best example I can think of is game maker 8's "instance_create(x, y, whatever)" function somehow you just type the name of the class you want to make and where yo uwant it and BAM it magicly appers on the screen what I have tried to do here is replicate it. Buuuuut the only way I have been able to figure out how to do this without memory heap allocation is by creating a instance(we will just call the instance of the class pizza for the purposes of explination) of what I want to make. Then inputing pizza into my CreatInstance function argument and having that function fill a element of a std::vector or array with a copy of the original instance(pizza)
Ex.
Code: Select all
//pseudo code.//
template<class Instance>
Instance CreateInstance(Instance A)
{
return A;
}
class food
{
public:
};
food pizza;
std::vector<food> B;
B.push_back(CreateInstance(pizza));
P.s What are you refering to when you say my understanding is to little the particlar topic, C++, format?(Again I do say I do understand C++)
"Why did we say we were going to say we were going to change the world tomorrow yesterday? Maybe you can." - Myself