User'S GUIDE TO C++ FOR C FAGS

there are too many faggots in this board saying c is the best programming language and other non-sensical shit because they are simply either too dumb or too lazy to learn c++ so they just stick with shittalking on c++.this guide is for those faggots.i only have 4 screenshots right now will make mor later.feel free to add your own shit to the list.

Other urls found in this thread:

youtube.com/watch?v=oIV2KchSyGQ
twitter.com/NSFWRedditGif

...

...

>Visual Studio
It's a good IDE, but isn't it a little overkill for your little programs?

...

>using c-style casting

Don't do this.

The proper method:
(static_cast(6) / 4)

these are some really simple programs.. how about some c++ specific stuff. The stuff you posted are generally the same among multiple languages

What a shitty thread

are you fucking blind

only had like 10 minutes for these.wanted to start with the simpler stuff.as i said will make more later.
feel free to add your stuff.

read/think before posting

uhh ok? i can do this in literally any language with pretty much the same amount of effort

One point in my TO-LEARN list that is there for way too long is to properly learn wtf are abstract, virtual and override keywords, how inheritance (especially on constructors and destructors) works and all this stupid OOP bullshit and what can bite my with unexpected behavior. Anyone knows some sane source with explanation?

> there are too many faggots in this board saying c is the best programming language and other non-sensical shit because they are simply either too dumb or too lazy to learn c++ so they just stick with shittalking on c++.

That's like your opinion man

...

2 images into the thread and Im already mad

youtube.com/watch?v=oIV2KchSyGQ

can you not screenshot your entire screen pls?????????????????

worth to mention: don't iter like this:
for (std::vector::const_iterator it = vec.begin(); it != vec.end(); it++)
because vec.end() is not const and thus called on every iteration. Either pre-assign it beforehand or really just use the for-each loop.

I take it that you haven't been programming for very long, especially not in C++.
If you keep at it you will hopefully realize that you fell for a meme.
None of what you are using in your examples bring much value and just add more unnecessary complexity to the language.
array is just another example of adding compile time overhead for no damn reason.
If you must use C++ for whatever reason then fine, but recommending it to anyone who may have a choice is just irresponsible.

no

for(int i : arrayy)
{
i = 1;
}

user, I...

do the auto keyword

>what is range-based for-loop

classic Cherno, always omits all the problematic parts

C is about simplicity. C++ is about pragmatism. Comparing them is idiotic. /thread

>mfw reading this thread

> /thread

kys

Fuck, I won't take the bait.

Anons recommend me a God Tier C++ book.

The C++ programming language :^)

Why are you using Visual Studio for you fucking Hello World programs hahahahahahahaha fucking low IQ winfags need their hands held every step of the way.

>installing 10 ides/editors for every size of program

>osu
Retarded kid confirmed. Come back with an opinion when you've gained enough age and experience to actually form a valuable opinion.

You definitely don't do anything beyond Hello World programs

>"i'm going to cry about the program he's using because i dont actually understand what he is talking about"

the absolute state of Sup Forums, installing 420 different tools and doesnt know how to use a single one of them

whats your point

You probably don't even know how to use Visual Studio beyond some basic text editing and the button that compiles your program. That's a lot of overkill for your small programs, especially when the compile time is a lot longer than it would be if you compiled it yourself. But, well, you probably don't know how to do that.

Can you even compile any code on Windows without an IDE?

that's pretty presumptuous and far from the point.

also its a fucking ide that and debugging is literally all there is to it you luddite

>low IQ winfags need their hands held every step of the way
They're worse than macfags
>h-how do I print to console again? Help me IDE

>blah blah blah I'm a fucking retard
I know that man, but you didn't have to say that about yourself.

>not using the int_fast* types
It's like you don't want to go sanic

>ConsoleApplication10
Do you even know how to create a .cpp file without creating an entire Visual Studio project? Fucking hell

>long
also, the actual reason it takes longer is because microshit links against over9000 libraries and telemetry and whatever the fuck they think so its no wonder your helloworld.exe binary is 12 gigabytes

here.

What a shitty thread.

>making very long sentences shorter


dude...

...

>sentences

i love auto, do you love auto?
auto a(auto u, auto t, auto o) {
return u(t, o);
}

int main() {
auto A = 0xA;
auto UTO = "uto";
return a([](auto a, auto uto) { return a + uto; }, A, UTO[0] );
}

...

Dumb thread. C and C++ are two different tools for different jobs, both with their own advantages over the other in different scenarios. Something something right tool for the job... much like IDEs vs. text editors.

Not him but clearly that you don't even know half the functionality of visual studio let alone use them you should just use notepad++ anything beyond that is overkill for you. Also someone with as little knowledge as you should not be trying to teach c devs c++ since you are not qualified as they prob already know more c++ than you do but decide not to use it and shill c.

...

most of his tips were pretty good. also, visual studio is the best tool for starters and 1337 hax0rsalike on windows, you really dont have a point here

>no
The absolute stage of neanthertal c++ programers who have not discovered the wonders of snipping tool.

Also:
>windows 10
>microsoft visual studio
>google botnet

>int32_t i = 4;
>uint32_t l = 12;
>intptr_t *myPointer = &i;
>uintptr_t *AnotherPointer = &l;
This doesn't do what you think it does.

This. Also he should spend less time having his hand held so he can get more familiar with C++ and actually learning the language. IDEs are useful for professionals working on big projects, but they can really hurt novice programmers who are learning because they begin to depend on autocomplete rather than knowing what they're doing, which all too often leads to overly complex code rather than a clean and elegant solution.

>implying i give a fuck what loonix fags say on a italian dildo-blowing forum.

>she doesn't write full-blown c++ applications using only wandbox.org
brainlets.

msbuild project.vcxproj /p:Configuration=release

Would it not compile if you made main auto as well?

>it's better because it doesn't have anything better than the original

visual studio already has experimental support for using auto for return types,though unfortunately you cant use auto for main.

this thread is cancer and the OP is retarded

gcc screamed at me when trying it. however, it likes this:
auto main() -> int

You seem knowledgeable user. Could you perhaps do a C -> Rust migration guide?

im not really interested in learning rust at the moment.maybe after it becomes a little more popular.but if i ever get there i will.

#include

auto main(auto argc, auto argv) {
auto a = 5, b = 'X';
printf("%d, %c, %s\n", a, b, *(char**)argv);
return 0;
}
wtf I love auto now

Did you fucking hear me? I said /thread, why you still replying?

>VS toddlers
Not even intellisesnse is going to be able to compensate your lack of IQ

>filename

There is literally nothing wrong with using VS

you can't switch from c to c++. you either chose c or c++. once you're settled with one or the other you're settled for life. everything inbetween is a compromise which means you suck in both languages.

This

>the post pointing out the fact that OP is using the data types completely wrong is the 6th (You) to the post
Fucking Sup Forums

so instead of truly showing what differs from c and c++ you chose to show some autistic syntax rules....
very high iq op

i personally prefer to use plain vim with makefiles. it's lightweight, comfy (for me) and it werkz.

>waaah he likes something i don't like therefore i think he is a retard waaah

are you using gcc or g++ for C++?

OP please keep posting, these are nice useful tips

I launch VS faster on my ramdisk than you launch your shitty notepad on your shitty 90s 2000RPM HDD.

functions marked 'auto' MUST have a trailing return type, or will receive a compilation error. thats why -> int works.

The compiler can deduce the return type since C++14.

thanks for correction

>++i

pajeet i++ reporting in

>void inc(int& n) {n++;}
>...
>inc(i)

So...all these C++ tutorials are really just teaching C?

So basically the OP was right, and most of Sup Forums are useless faggots that don't actually know anything. Hence all the autistic screeching and desperate attempts at "trolling" anyone who responds.

>visual studio
didn’t even expand the thread pajeet

Yes.

C and C++ used to be "almost the same" until when C++11 was released. It's barely the same language. If you're learning C++03 or (god help you) C++98, that shit is all different.

A thread about C++ and nobody has mentioned template metaprogramming? What the actual fuck Sup Forums?

#include

template
struct factorial {
static const int value = n * factorial::value;
};

template
struct factorial {
static const int value = 1;
};

int main()
{
std::cout

Don't do it the retarded way, do it with constexpr.

>It's all done at compile-time
That’s the problem.

Well thank you for pointing all this out, really. Fully appreciate it.

guide to C++: use D or Rust instead

D first, then Rust if at all.

>object oriented pajeetery
No thanks, I'm white.

Is @safe D code actually safe like non-unsafe Rust code?

Yes, but templates makes you a l33t hacker, dude.

more like l33t moron XD