I started learning C++ yesterday, ask me anything!

I started learning C++ yesterday, ask me anything!

why has nobody made volume control that automatically adjust the volume, so everything is at a perfect volume when it comes out of the speaker?

...

what's the meaning of life?

having fun

We made at school an amp with a feature like this but that actually werks superfast.

How do i learn C++ IN 2 weeks?

OP here: I have a solid background in Java and I done assembler programming. I think it will be perfectly doable to learn the essentials of C++ and stl in two weeks.

>>>>java
pajeet spotted

>5 pesos has been sent to your account by microsoft

I'd like to learn both Java and C++ but have no background in programming.

Where can I learn for free or very fucking cheap

How do you place a struct after the main method?

I want to learn C++. What resources you using? Any experience of programming before or is this your first language?

> Not learning patrician Ada

Seriously take some uni courses, education is free right. I have been programming all my life but i still learned a lot about developing software and uni forces you to learn the stuff properly.


Currently im reading Jumping Into C++ by Alex Allain, i really like the book but it's a bit outdated so ill have to use some other resources as well later on.

>Any experience of programming before or is this your first language?
Various assembler languages, Java, Python, C#, R and probably some i cant remember. Im still a student though...

why?

Have you ever had sex with other guys?

because im so tired of blabla.blabblaFactoryCreator.getAbstractModel

Nobody cares.
Leave.
You have nothing to contribute to the discussion. This isn't your blog. You don't know anything nearly enough to be able to answer any questions.
Fuck off.

>the discussion
Now what would that be?

>The discussion
As much as I'd like more intelligent talk on this shit hole, at least I'm not delusional.

Do you want to make video games?

Why did you pick C++?
And what do you think about manual garbage collection (as oppose to Java).
Also this.

We just want to sit back, chill, and talk about C++.
But there's ALWAYS that one douche who spergs up these kind of threads...

Why you gotta be that guy?

>Why did you pick C++?
Because I like the syntax


>And what do you think about manual garbage collection (as oppose to Java).
It's part of the fun and unless you use 'new' everything is managed for you anyhow


>Do you want to make video games?
I already do ;^)

You'll have to use new once you get more into dynamic allocation (it's where c++ shines), plus it's a good idea to use the heap rather then the stack (for a more stable result).

Besides C++ it's so much better then java as you have actual control over the memory footprint of your app.

Just wait until you start messing around with the lower level functions like malloc, memset, memcpy, and free, that's when the real fun begins.

How do you decipher complicated template compile time errors that spawn what feels like an entire essay? Like ones you can get from boost. Sometimes I work on pretty huge codebases that take eons to compile even if you ensure to only compile changed compilation units.

>You'll have to use new once you get more into dynamic allocation (it's where c++ shines), plus it's a good idea to use the heap rather then the stack (for a more stable result).
With C++11 there are close to no reasons except for legacy reasons to use new.

>Just wait until you start messing around with the lower level functions like malloc, memset, memcpy, and free, that's when the real fun begins.
This is something you should never do in C++. If you want to code in C then code in C.

>telling people about Ada
>not keeping the high paying DoD jobs a secret
>making software safer
kys

>Don't use stuff from C
>in a language that has as one of its main selling points: go low level with C any time you want to

Hell the standard library even has built in functionality for determining if a class is POD(aka safe to use memcpy on).

Learning it requires reading books. I think I'm safe.

>using boost
Why?

>Hell the standard library even has built in functionality for determining if a class is POD(aka safe to use memcpy on).
That doesn't mean it should be used.

Listen, dipshit, there is always someone trying to learn a new language here on Sup Forums... hell, I, too, am learning a new language every few months or so. Some I will use for work, some will be forgotten or just used as a hobby, but I won't sperg out on Sup Forums about it.

Why?
Because I. DON'T. KNOW. SHIT. about the language I'm currently learning. It's my duty to read all available resources and try to get acquainted with the language's ecosystem. Until then, I will most certainly not let Sup Forums know about it, because if we all did that, there would be a "HEY GUIZE I JUST DOWNLOADED A PDF BOOK FOR LEARNING PYTHON, AMA!!!" thread every 10 seconds. You're not special. Got it?

Hell, if you posted such a thread even on plebbit, you would get downvoted to hell because AMA means you have something worthwhile to say... but you don't. Why? Because, like I've said, you've just started learning the language - you don't know shit. You didn't even wait a few days before deciding to tell everyone how you're learning a new thing. When you can say "I'VE BEEN DEVELOPING C++ APPLICATIONS FOR THE PAST 5-10 YEARS, AMA", then you can create a thread and I'll be more than honored to ask your a question and learn from your experience.

Go to the programming general and ask questions there if you have any, otherwise, fuck off.

Platform independent sockets mostly. I also sometimes use the xml serialization in there when protobuf feels overkill. Honestly there are tons of useful shit in boost. That's why parts of it gets thrown into stl.

Still your question doesn't answer my question. Pretty much any lib using template metamagic programming will spawn undecipherable compile time errors.

Yeah what does Stroustrup know anyway? He's the guy who kept all that C shit in C++ after all.

why would anyone want to ask you anything?

If you're using a creative sound card, it's svm in the creative control panel.

Do you still have motivation to keep programming?

Do you fap to trannies too?

>kept all that C shit in C++
that was the point of the language autismo. he wanted to build on the success of c and add all the object orientied fuck that he saw in smalltalk.
this way you can integrate almost any c library into your shitty program and save yourself some time which you will use for gaymen.
you really must have terminal assburgers if you argue that you should use the c-library functions because they are in the language. even handling new and delete outside of classes is considered retarded since you have raii.

>if you argue that you should use the c-library functions

Email Stroustrup. He's the one saying memcpy is useful in c++. Right there in his book

you don't. Real advice? Build something

forward declare it

codecadamy and Google it you lazy nig

I haven't seen this copy pasta before

In his faq he also advise against using memcpy. Can use != recommended like many other features of C++. If you are so concerned about performance that you use memcpy to initialise a vector you are probably working on an embedded platform and C would still be a better choice.

>ask me anything!
Okay!

>I started learning C++ yesterday
What's wrong with you?

>Education
>Free
pick one.

And in his book he's writing code that uses it. He's saying it's used in the STL to do things like copy vectors. He's saying here it is and here's when it's good to use. Yeah in his FAQ for pajeets and kids he's like fuck off you're reading a FAQ I'm not explaining to you what POD is.

>If you are so concerned about performance
Why should I take the performance hit of setting up a loop to copy a 1000000 bytes one byte at a time when I have a 128 bit sse register sitting around and a fat ass data bus from RAM? Embedded stuff where picking C over C++ is needed is 8 bit PIC level of capabilities and it's not going to benefit from moving more than a byte or 2 at a time because it can't.

t. someone who has actually done embedded

I know a bit of Java and find it a bit better than C++ for OOP-heavy projects.

Did you just assume his gender?

Pretty sure shared_pointer and so on are implemented as C++ code using new. So technically you're still using new, just not directly.

>You shouldn't care about performance unless you're working on embedded systems
People like you are the reason why I need 100MB of RAM to edit a 500 byte text file.

#include
using namespace std;
int main()
{
int a = -10;
unsigned int b = 0;
while(a < b)
{
cout

> he thinks modern compilers can't optimize copy assignment with POD types

lul

>Been learning perl
>Go install a module to fuck with some other stuff
>CPAN repeatedly shits itself

You have a background in Java and you didn't think going to C# was a better idea?
It's people like you that end up making vulnerable C++ applications because you've learned such shitty practices.
No one should learn Java as their first language. Realistically, no one should learn Java at any point, but I guess it's going to happen so I don't normally tack that on.

Google this:
The C Programming Language pdf

Found the retard

Runtime error. Next question.

>Implicit conversion
Epic, C++

>Pretty sure shared_pointer and so on are implemented as C++ code using new. So technically you're still using new, just not directly.
Yes and just because you can overload new and make your own allocation scheme doesn't mean it's a good idea.

>People like you are the reason why I need 100MB of RAM to edit a 500 byte text file.
Linking against modern libs kind of have that effect. I'm confident that rolling your own memcpy to initilize a std vector instead of letting the compiler optimize it is a bad idea. What's more important in most cases is writing secure, readable and maintainable code.

But what do I know. I've only been around developing for a living since the punch card times and coding in a terminal without an xserver. I can assure I prefer writing code in a modern IDE or emacs that may require significant more RAM than an ancient 80 column terminal machine.

AA BB(CC);
Is this an object definition or function declaration?

Object declaration

why u hef to be mad

This gives a compile-time error because of comparison of signed integer with unsigned integer.

Cant you just cast the unsigned int to signed?

Initially point of C++ was just to make compiler deal with some essential boilerplate common for object-oriented programming on C.

>What does this do in C++?
It makes demons fly out your nose.

sure, and you can cast signed int to unsigned int as well

This compiles and runs without any errors or warnings. This is not a runtime error. It is allowed by the language. So what is actually going on here? During the a < b, there is a coercion of a from int to unsigned int. What happens is the twos-complent of a is used as an unsigned int which makes the value of a become ((2^32) - 10). This so happens to be greater than 0 so the loop never executes.

Have fun with the weirdness of C/C++ coercion and conversion rules. I always found them weird and fun.

>This compiles and runs without any errors or warnings.

op i ask you to implement a fast, conformant xml parser using only C++ and stl.

>fast
>conformant
>xml
You can only chose two of these.

Literally nothing because of the way unsigned and signed and unsigned integers are represented.

shut the fuck up lol

it works
casts the int to an unsigned int

CPAN is overrated as fuck. Full of ASCII memes, unmaintained packages, half of which is QA to do Perl damage control.

Some of the clients go into an infinite loop on some packages.

Is this the correct way of using pointers with functions?

lol no

>correct way
>using pointers
You should go and become a pet shop worker or something. Just keep away for computers.

Suicide date when?

>can't split a fucking vector in two.

Why not D?

no. pointers were used in C to achieve what in C++ can be done with references.
so either use (int &x) and just operate on x, or use (int *x) and then assign values to *x.

Pointers really shines when you have a huge class that you don't want to throw around all over the fucking place, taking up memory and whatnot. A pointer is always the size of a pointer, which is very nifty.