• Forum
  • Lounge
  • A program which's main never gets called

 
 
A program which's main never gets called

Pages: 12
So, I am new to C++, I have been programming for a couple of days now. So I made this hello world to test my skills. Wondering if this program is practical. Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>
int getInt()
{
        std::cout << "Hello World!";
        return getInt();

}

int z = getInt();

int main()
{
        return 0;
}
closed account (jwkNwA7f)
This eats memory and is not practical. There is no point, really.
So what do you think I should learn next, pointers and the heap, or RAII?
closed account (jwkNwA7f)
They are very similar. Pretty much synonymous.

EDIT: Go ahead and learn both if you think you are ready.
Last edited on
Okay, then. Thanks a lot!
I wish I had Disch's facepalm.

I am smelling a big fat trolololol.

Two things:

1) You don't know that kind of code to make that kind of program when you started a few days ago.

2) Neither do you have an inkling of RAII when you are a 3 day programmer.

If I am wrong, correct me.

EDIT: Oh, and another thing: I saw his "THIS IS NOT A REAL TOPIC" post in the beginners section. This only deepens my suspicions. :|
Last edited on
Do you challenge my ability to learn quickly? I am top of my self-learning class.
Disch, I really need your facepalm. Does anybody else here think that this is impossible?
closed account (jwkNwA7f)
Now that I think about it, that does sound rather fishy.
Well then, you guys apparently don't think that learning fast is plausible and realistic. I may go to another site. Thanks.
Well, maybe you did learn that. But I ask you this: What is RAII? Do you even know?
Last edited on
closed account (3qX21hU5)
Superdude wrote:
Disch, I really need your facepalm. Does anybody else here think that this is impossible?


Superdude wrote:
Superdude: Well, maybe you did learn that. But I ask you this: What is RAII? Do you even know?


No but I do think you are just being rude.

When a new programmers gets greeted with these types of replies it isn't very welcoming and is in fact quite rude , so instead of doubting others abilities and calling them out on being a "troll" with no real evidence to back up your claims you should instead just ignore the post or post advice like he was asking for.


@robot66

You are actually doing very well for a few days of studying and are on the right path. There is a few minor things with you code but mostly I would say good work for picking it up so quickly.

As for what to learn next you might want to take a look at the tutorial on this site. You can either read through it (It has a lot of good information in it) or just use it as a reference for what to learn next.

Remember the simple things that you learn early on like variables, if statements, loops, ect are the building blocks for more advanced aspects of ++. So don't get ahead of yourself, take it slow and make sure you understand everything.

As for the RAII and pointers question. Yes I believe you could start learning about pointers now and that might be a good choice but personally I would recommend holding off on RAII till later after you have learned and fully understand how OOP and classes work.

Well then, you guys apparently don't think that learning fast is plausible and realistic. I may go to another site. Thanks.


I would like to apologize for the others and most members aren't like that. This forum usually is full of helpful people that are always willing to help. Though as a suggestion I would recommend posting any questions and code reviews like this in the beginners section where you will be greeted much more friendlier. Sometimes in the lounge people can act like asses.

Anyways best of luck with your studies.
Last edited on
Resource Aquisition Is Initialization. It is used alot with multithreading. It is a memory management tecnique
Last edited on
I'm sorry. I should have listened better. Hope you do well. (robot?) :D
closed account (jwkNwA7f)
I'm sorry too. I shouldn't have jumped to conclusions like that. Good luck!
Thats fine. :D My name's Andreas. I am new, do you know of a place to learn better? Like skype group?
closed account (jwkNwA7f)
Here's a skype group: http://www.cplusplus.com/forum/lounge/113040/
Yeah, that one's good. That's a good way to wiggle a "bump" in retsgorf. ;)
Wow, thanks. It's actually a very nice group. I can recommend it. Don't wanna put other groups "out of business", but I'm having so much fun here! People are funny, nice and very helpful! Thank you! :D
@Superdude
I agree, I have to be honest, I've been doing programming for 19 years (forgot about my two years of BASIC), and honestly, I don't know what RAII is because I've never had a reason to look into it. There are a lot of topics I've never looked into, that I really should.

@robot66
Any serious programming site will tell you the same thing. Only a site full of programmer wannabes will lie to you and tell you what you want to hear about being able to learn fast. Simple fact is that programming is a complex matter and requires a lot of skills that you have to learn through programming and solving the problems it presents. Knowing topics or meanings really doesn't mean you understand their implementations.

This does sound rather BS-ish. Also, you can't avoid running main as that is the point of entry for execution for the executable. You code would never even run because you have to put the code you want run during execution inside main. That recursive function is useless too as there is no way to break out of it so it would waste resources returning the function over and over. Though, that again isn't a problem because it won't execute since the call isn't inside main().
Last edited on by closed account z6A9GNh0
Pages: 12