C++ Discussion Thread

Are you for or agnist these:
- Templates
- STL
- Standard, C++ specific libraries
- How classes and everything related to them works
Generally, is(and why) C better than C++?
How you would fix it?

Go!

Attached: cpp_logo.png (918x1032, 45.06K)

Other urls found in this thread:

github.com/electronicarts/EASTL
youtube.com/channel/UC-yuWVUplUJZvieEligKBkA
twitter.com/brianhatfield/status/804355831080751104
en.cppreference.com/w/c/keyword
en.cppreference.com/w/cpp/keyword
esr.ibiblio.org/?p=7303
medium.com/@CBowdon/esr-is-right-about-discovery-cost-and-rusts-stdlib-c7a1839dca8e
harmful.cat-v.org/software/c /
gcc.gnu.org/projects/cxx-status.html
twitter.com/SFWRedditImages

No point in discussing, C++ devs gets ultra defensive and butthurt at any sort of criticism of this god forsaken language

Still no better language around than C++ tho

Attached: legend of galactic smugness.jpg (960x720, 105.83K)

You already described the solution in your post

/thread

That's called C, bloat lover.

Gas yourself.

I think c++ is better than C because it is c + new stuff. You can compile c code in c++ compiler and get the same binary and most of the c++ stuff that makes programming easier doesn't have any overhead. For example class methods are exactly the same thing as normal function that takes a pointer to some struct object and does something with it (same mechanism). Constructors and destructors are also a very good feature, you don't have to call free () / destroy() type of functions manually, although you can if you want to and that's great, you have options to go low or high depending on your needs.

The standard library is also very good, people writing c only might scoff at it but it's rare that you can write faster implementation than what's in STL nowadays. Also c++ can do a lot more at compile time than C which of course is very good for your program. For example if you have some array that you update as you are writing your code (a table of functions for example) in C you often see that they make the last entry 0 and do a loop untill they hit that zero or they have to manually update the array size (some #define func_count 10 etc.) but in c++ you can take the size of that array at compile time.

C++ is strongly typed but you can still do C casts or just disable compiler warnings if you really need that.

I like C and when I have to just write something fast I usually start with c, but if I need some hash table or just expandable container I'll just use the c++ map or vector instead of writing my own.

There's couple of things I don't like in c++ though. Streams are for niggers, printf for life. shared pointer in single thread program is also a sign of mental retardation. Returning or passing by argument of large objects (you can do that in c but it's mostly c++ programmers that do that) is something I despise. I don't like references. They are basically pointers but look like the object when used which is just hiding the fact that something is a pointer. What's the point ?

Throw it in the trash, start over with C11 and add basic features like constructors/destructors, default values for structs, optional function arguments, and variadic arguments (no, C's stdarg.h macro bullshit isn't a good variadic arguments system). Also add dynamic arrays and improved string mechanics.

I could also complain about syntax but soon it'll just be better to just use a different language.

GC issues are overrated. Especially considering you'll have to manually develop a system to manage memory that most likely will be only slightly more efficient than the GC.

you mean std::vector?

This. I know everyone on /g... I mean Zig Forums is an embedded chipset firmware developer, but in the real world GC is very much worth the extra 0,05% of performance you lose on your shit program anyway.


You cannot pass a null reference, so having a reference as a function argument protects you against segment violations. Of course, you can always do (*(void*)0) to get a reference to NULL, but that's dumb.

No. I mean dynamic arrays. Take your """vector""" and shove it up your ass along with C++ itself. If we're fixing C++ then we're renaming the C++ "vector" into dynamic array.

You know vectors are dynamic arrays, right?

So you're saying you want D? Honestly, consider it. If you're okay with having a GC or are willing to work around it or turn it off, D has an incredible, cleaned up feature set that puts C++ to shame, in my experience.

Attached: 1511041222631.jpg (601x665, 173.1K)

You can't have a good discussion about C++ on Zig Forums as it's too complex a language for anons and it's also too mainstream which makes it uncool.
But I'll just kill a few shit arguments while I'm here.
C++ is no more bloated than C as it's almost fully compatible with C. It gives you more tools, and they're dangerous tools that can lead to bad programmers easily creating bloat. A valid criticism of C++ here is that it makes doing the wrong thing easy, and that a "bad programmer" to C++ is a Godlike programmer to today's software landscape, so it's difficult to find anyone these days that can wield it effectively.
GCed languages are incompatible with a lot of things people use C/C++ for. I use it in networking where the "GC only takes 10ms!" hype of Go sounds absurd when you consider how many packets would get lost on a 10GbE network during that 10ms. Brief blackouts like that do a lot more damage than you'd probably think as it causes rate control algorithms to panic since the RTT is nearly in nanoseconds on those networks. It can take a while for a network to recover and stabilize.
D is a joke. I'm not sure why so much effort has been spent trying to make a dead horse race.

How can you say such bullshit and look yourself in the mirror?
du -h /usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/libstdc++.so.6.0.22 /lib/libc-2.26.so13M /usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/libstdc++.so.6.0.221.8M /lib/libc-2.26.so

I don't think you know what 'compatible' means. C++'s name mangling is everything but compatible.

Why?

Let me contribute to this obvious datamining thread, lol.
For, when used for containers and certain helper functions (sparingly).
Against when abused for template metaprogramming.
For. In fact I'd wish they'd go all the way and completely deprecate the C subset of the library. C++ is not C, never will be C, so let C++ not be C. Stop trying to embrace, extend and extinguish C by saying "here, C++ includes C stuff though they're incompatible with the C++ stuff." malloc vs new, stdio vs iostreams, rand() vs and so on. Cut the bloat, clean up C++, and stop trying to kill C, Stroustrup you fucker.
Against, mostly. I'm a brainlet and I can't think through multiple levels of inheritance. Inheritance is a sort of obfuscation. If you're stuck in a plain text editor, without doxygen docs that include a list of the inherited functions, or IntelliSense giving you hints, you're dead meat. You look at the class definition source code, and it's incomplete. The inherited code is effectively hidden. Go open another file, then another. That's redirection, and it's bad for the brain. If you're a brainlet like me at least.
It's simpler and has the potential to be more elegant. No invisible exceptions that swim beneath every line of code, but never seen outside of try blocks. No invisible function calls (ctor, dtor, overloaded ops) behind your back. No overloaded functions and templates so that you never quite know for sure what gets called without checking the argument types first (which is a pain without IntelliSense hints).
How to fix C to make it better? Well I'd make arrays and strings first class citizens (no more decay to pointer) and with automatic memory allocation and deallocation, but not necessarily by way of garbage collection though. Basically I'd look a way to make working with strings painless and take away memory allocation/deallocation control from the programmer so that he can focus on actual work not bookkeeping.

...

You're making yourself look silly by dismissing a language just because it's garbage collected. What other reasons do you have for not liking D? Yeah, yeah, now stop giggling like a schoolgirl, at the "D". I've used D for little exercises, its library is so much better than C++'s, by design. It's very practical minded. It even has a library for MD5 checksums.

as long as they don't shill it as a c/c++ / rust alternative thats fine. otherwise fuck off
oh shit nothing else has that!

Oh, so that's what your problem with it is. Rust shill attacking D because it's a competitor. OK, got it.
Well C++ doesn't have that, and it's nice to have practical stuff in the library. Think how you'd go about implementing MD5 on your own, in pure C++, using the stuff from . It would be a huge PITA, don't you agree, which goes to show the library of C++ is maybe too minimalist for a supposedly high level language. C++ says "here, have some bricks, wood and glass, build yourself a house." At least C gets away with minimalism because instead of heavy bricks it only gives you a shovel to dig yourself a foxhole. Just be careful not to bury yourself.

Best standard template library coming through
github.com/electronicarts/EASTL


The problem with C++ isn't the language itself but the majority of people who use it. So many times I have looked at "C++" code on github, sometimes from large companies such as Nvidia, and seen nothing but the most atrocious C code imaginable. It seems most people "use" C++ purely for the ability to say their project is written in C++ and not for the actual benefits it provides such as templates and classes (and by extension the absurdly powerful things they allow for).

You would never do that because its retarded. You would import the algo portion of same *SSL implementation and use that.

snd line
*I hate rust

gfo

the only way GC wouldn't be useful for embedded systems is if they have really low RAM. luckily today an embedded system is just windows 10 running on a rasberry pi with 4GB RAM and 2GHz CPU

what the fuck is this some kind of b8? D is stupid for the same reason C++ is stupid. precisely because both languages could even have, nevermind a library, but an MD5 operator and MD5 syntax and the users would still take it seriously

C++ is much more strongly typed than c

Even though this is a C++ discussion thread and not a general, I would like to let you all know that I really like this guy: youtube.com/channel/UC-yuWVUplUJZvieEligKBkA


twitter.com/brianhatfield/status/804355831080751104

Attached: unnamed.jpg (900x900, 83.18K)

For science and engineering, Julia looks VERY promising, but it's taking forever to reach 1.0.

Pretty much tbh, I work in what is technically embedded, and most devices have 256 or 512 MiB of RAM and a relatively good ARM v7 processor, which runs a full version of Linux 2.6.x.

Conveniently ignoring throughput. GCs can only balance between those two.

Go

The alternative is ugly as fuck and unsafe unless you always put the referenced value on the heap. References solve that problem because they can't be null (except without horrible, deliberate abuse that a typical C++ noob would never think of doing), so you know it's valid.

If you knew how generational GC worked you'd know you can produce all sorts of fake speed numbers for it by ensuring all your data isn't in the generation that needs swept. Real programs that grind a lot of data rather than just idle with a large heap by necessity require large sweeps and that takes a large amount of time. There's no way around that, it's like trying to go faster than the speed of light.

You don't have to use libstdc++, newfriend. C++ is no more bloated than C.

Rust wins again. How will sepplesfags ever recover? du -h .rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/libstd-ddeed4efba8e9952.so9.3M .rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/libstd-ddeed4efba8e9952.so

C and C++ are not even related. Stroustrup just happens to allow certain C keywords to work, but the way C++ operates is in no way the same as C.

Find me a compiler as simple as tcc or pcc for C++. You won't find it because the language is bullshit with an ambiguous grammar. And if you want a "clear" argument, look at the number of keywords:
en.cppreference.com/w/c/keyword
en.cppreference.com/w/cpp/keyword
Another one:
> archive-extract.sh -d . /usr/portage/distfiles/gcc-6.4.0.tar.xz> du -hd0 gcc-6.4.0/gcc/{c,cp}1.7M gcc-6.4.0/gcc/c9.7M gcc-6.4.0/gcc/cp

As much as I hate C++, Rust with its soyboy NodeJS style crate system is even worse.
esr.ibiblio.org/?p=7303
medium.com/@CBowdon/esr-is-right-about-discovery-cost-and-rusts-stdlib-c7a1839dca8e
For more. There's something between an empty stdlib and Python.

Not everyone wants a bloated std.

Better than three gay student projects fighting to do the same thing. I'm perfectly fine with something like the POSIX API, at least its reach and size.

Jesus fuck user, there's stupid and then there's whatever that was.

Genius, because I don't fall for that "C++ is C with classes" myth bullshit.

All I hear are tears. Who fucking cares how complex the compiler is? It just has to run fast and produce good output. As a language, C++ is no worse than C and can be used as just a massively improved C at zero cost if desired. If you end up with bloated code, it's entirely your fault.

user@anon:~/tmp$ cat foo.cc#include int main() { printf("What's the matter user, can't into C?\n");}user@anon:~/tmp$ g++ -static-libstdc++ -O2 foo.cc && strip a.out && ls -alt a.out-rwxr-xr-x 1 user anon 6304 Jun 18 13:16 a.outanon@user:~/tmp$ gcc -O2 foo.c && strip a.out && ls -alt a.out-rwxr-xr-x 1 user anon 6304 Jun 18 13:17 a.out

You're comparing apples and organges when comparing C and C++. Sure they are both fruits both programming languages and both are round similar syntax but that's about all the similarities you can get out of them. C++ is fundamentally different than C because it had a fundamentally different invention than C.

When it's harder to find a thing your language can't do than one it can, you know it's time to stop. C++ is just an enterprise garbage where they can put what they want in the standard since they don't care about design, only about their own 20% of C++ they use. As said, if you want some "high level zero cost" bullshit that will swarm with invisible stuff going on, C++ is for you.

You can read harmful.cat-v.org/software/c / for more (especially the Links part). To be really honest, what made me stay really far of it is the overly complex syntax and the horribly dense cruft of decades of piling up shit on C instead of creating a really new language; Rust seems like a cleaned up C++, even if it has a Perl style abortion of a syntax; still not a replacement for C.

Wow! Such an informative site! I really do love some random mashed up quotes by cat-v retards. Really makes me hate C++.

Probably why I pointed to the Links section, retarded tripfag.

Thanks for C++99 related links. Sure does speak a lot about modern C++.

trip fell off

Why do people get so angry about C++? It's a good language.

The post you're replying to showed it has no bloat. 'C++ is bloated' is a meme created by bad programmers who write bloated code and blame it on their tools. It is no more bloated than C.
wew. Who are you going to refer to next for sage advice, Terry?
Rust is a meme. It was clear when they froze 1.0 in a useless state that the project would never go anywhere as they don't think it needs to. It's a NIH Ada that is only usable on toy projects.

Because it's hard, and modern programmers bitch and moan at anything more difficult than jQuery rather than man up. Low T soyboys and transfaggots everywhere.

It's a pain in the ass and I'll be old by the time any of the things to alleviate that pain clear the committee.

It was fine after C++11.

It's not hard. It's stupid and encourages bad practices.

It's hard. Avoiding bad practices is hard.

Why hasn't language related been rarely picked up outside of critical infrastructure, aerospace and the military usage?

Attached: ada cover.jpg (481x650, 44.21K)

It's not even used in the military if it means additional costs for the program.

Using a language full of bad practices is stupid.

Yes user power is dangerous. Most things should not be written in it. However when needed there is no alternative. For the most part no one should be managing their own memory directly. But when you are writing something like say a game engine or a simulator you need that.

Because it was created as part of a contract for the military.
Probably the only language with a back-door in it.

The only reason why you would consider doing that is 1) you trust whoever wrote your compiler and 2) you are incapable of understanding how the machine works.

I do frequently use it. I do accept that if done way to much it might make the code look like a total cluster fuck that take more time to read. I also dislike the fact it has to be always declared in the .hpp file.

I've once heard a teacher that told us that for some performance issue, it is possible that we might ignore the STL and roll up our own data structure. Up to this date, this scenario never happenned to me.

shit is lit'

I prefer C for the simplicity. Every programmer should be able to program in C.

I'd appreciate if we could use an enum class has the key of a std::unordered_map.

What the fuck are you on about.

That's C. "Reflections on Trusting Trust" is not hypothetical.

Just use tcc first to bootstrap your real compiler and its all solved

I am saying that compilers are not written by (you) and that (you) cannot know how the machine works unless documentation is provided. It's not that difficult to write an optimizing compiler. The only difficulty in it is time.

Look faggot the same thing applies to an assembler, it applies to the hardware itself, it applies to everything.

No shit numbnuts. You aren't biding your case.

What is your fucking point? You have not made one so far. Just repeating obvious shit.

My point is that everything is suspect in this botnet world regardless of open source or free software or whatever gay ass label you want to give it. You won't audit several million lines of source because you don't want to or don't have the time. What do you think the probability of anyone wants to audit that code and has and is willing to give the information they learned out? Any software that parses information can inject malicious code into a machine, and the machine itself now has malicious processes designed within it. It's worthless to argue about which language is better or which architecture is better because it's all compromised since for at least a decade. If anyone cares about having a truly free and truly open platform with truly free and truly open hardware and software then there needs to be a fundamental push by the community with real backing to move it forward. If all anyone is willing to commit is to tweet this, share that, like these, then nothing will be accomplished.

And what the fuck does this have to do with c++ discussion that does not apply to literally everything that exists?

Entry-level cliff.
People program in C and C++ because there are free C and C++ compilers.
Any idiot can shit out a slow, buggy, inefficient C or C++ compiler and it can grow to be a more efficient, less buggy compiler. Ada has a test suite that has to pass. You can't fake it till you make it. It is perceived that Ada is a more complex language, because the compiler has to actually work, whereas a C or C++ compiler can leave out any feature of the language the writer doesn't care about. That's why there are ton's of free, shitty, C and C++ compilers, and only one free Ada compiler (which the Air Force paid for).

Bullshit they won't be able to compile any real existing code base.

This happens regularly, it is not an isolated practice. Just because you don't know about doesn't mean it doesn't happen.

You would be surprised at how many features of C andC++ aren't used by many real existing code bases.

There are 4 major compilers that all support the features of c++ 11. ICC, GCC, Clang, MVC++. These are fast and feature complete systems.

like what

And how many iterations did it take for these to become fully C++ 11 compilers? They picked a handful of features of the language to implement and did so. GCC isn't feature complete: it lists "Minimal support for garbage collection and reachability-based leak detection" as not done. And it is that pick and choose attitude that exists for C and C++ that is why there are so many more compilers.

Every feature that was in C++98 and was deprecated or removed in C++11. No one ever implemented export. std::auto_ptr was garbage and few used it.
There are code bases that don't throw exceptions. I wouldn't miss std::complex. I watched a video that implied the Ubisoft insisted on writing its own version of the STL for "Sanic Speed!!11"

You do realize garbage collection is not a feature of c++ and that is an ultra fancy add on that they are playing around with?

...

That GC thing is actually in the C++11 standard. It's just a couple basic things so that someone could implement a GC within the C++ memory model (or something like that). Nobody cares about it. Calling GCC not feature complete because of that shows doesn't know shit.

Point out exactly what you mean in the standard. You don't have to cite the standard document itself, a site that says its in the standard is fine. I am again calling bullshit.

What c++11 DOES have is custom allocators that you can plug into numerous parts of the STL and that IS well supported.

Okay so I went and found an actual gcc site referencing your thing.
gcc.gnu.org/projects/cxx-status.html
There is a total of ONE thing, and thats it that is not supported. That ONE thing is not supported by ANY of the compilers, and was strictly declared as an optional extension.

Thank you. That was my original point. People writing C / C++ compilers can ignore whatever they want in the standard and call the compiler feature complete. They can leave out the entire standard library and call the compiler feature complete. You can't do that with the US Government's Ada Standard: you either support the language as confirmed by a test suite or you do not. And because of that, and because most software developers are lazy, they say "fuck that, I'll write a C compiler".

What do you think unique / shared pointers are?

Not garbage collection. Shared pointers have strict dealloction, cannot support cycles, are created explicitly, etc.

Bullshit a SINGLE FEATURE, universally not implemented by the core 4 compilers, that is an OPTIONAL EXTENSION, does not make your point. If it was say 10 different things mixed between the compilers you might have a point but you dont.

I hope you're only pretending to be retarded as that's pretty embarrassing otherwise.

It's the weakest example you could have used and you act like it proves that GCC is made by lazy people who are leaving out half the standard. I even agree with you that it's better to have standards for your standards. But your point about compiler writers being lazy is just weird. The big 4 are massive pieces of work and C++ compilers are notoriously hard to write.

...

are you the retard from /agdg/ that "worked with c++ for YEARS" and has no idea how the language works?

Attached: 6654645666555.png (261x381, 123.18K)

WW3 can't come soon enough.

Attached: o_o.webm (1920x1080, 511.71K)

But the C++ STD lacks features, user. There still isn't a DateTime class, still no standard networking...

C and C++ developers who want to stay sane should stick with C89 and C++98. After that the languages (mostly C++) became victims of design by committee. It is more trouble than it is worth to maintain projects without a stable base.

--Bjarne Stroustrup

Attached: oceans-chase-sinking-videoSixteenByNine1050.jpg (1050x591, 101.1K)

Not literally everything has to go in the std

Yes, it's a simple refcount based garbage collector.

Nope, and if you can't see smart pointers as being a form of garbage collection maybe you should learn how the language works.

Wrong. A garbage collector implemented with ref counted smart pointers is not the same thing as a smart pointer.