Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

[C++] Pros and Cons?

Name: Anonymous 2012-05-18 22:10

Name: Anonymous 2012-05-18 22:14

Pros:  adds a bunch of shit to C
Cons:  adds a bunch of shit to C

Name: Anonymous 2012-05-18 22:28

C is shit

Name: Anonymous 2012-05-18 23:02

>>3
A reason or two would be nice.

Name: Anonymous 2012-05-18 23:32

>>4
Its because of your gay.

Name: Anonymous 2012-05-19 0:01

Today, I found an implementation of C++ that gives you the string "Infinity" if you try to divide by zero. Also you never have to include string, algorithm, or any C headers.

Name: Anonymous 2012-05-19 0:10

>>6
I think you meant php.

Name: Anonymous 2012-05-19 0:43

>>7
Get dem dollars

Name: Anonymous 2012-05-19 1:08

C++ is a systems programming language
Pros: programmer has total control
Cons: programmer has total control

There is not much reason to use C++ with the processor speed weve had in the last 10 years. There are other compiled languages that are just as fast as C++ and a lot safer and easier to use.

Name: Anonymous 2012-05-19 2:14

>>9
Is this one of those ``trolls'' they talk about on Reddit?

Name: Anonymous 2012-05-19 2:31

>>9
It is not difficult to create wrappers to make C++ just as safe as any of those other languages.

Name: Anonymous 2012-05-19 3:12

>>11
yeah, but everybody has their own wrappers

Name: Anonymous 2012-05-19 4:22

>>11
With the amount of work needed to do that properly, it's probably better to choose a different language with these constructs designed into the language when choosing to start a new project.

Name: VIPPER 2012-05-19 4:45

>>10
No, you are the trolls.

Name: Anonymous 2012-05-19 18:09

Pros: Allows for the safety of encapsulation offered by a modular object oriented language while maintaining the sheer memory and clock cycle efficiency of a low level language like C.

Cons: Compile time is a heck of a lot longer than with C

Name: Anonymous 2012-05-19 19:17

>>11
Hahahahaha. No.

They're not checked, and if you've created them yourself they're poorly tested to boot.

Name: Anonymous 2012-05-19 21:07

You can implement encapsulation when you want/need it. It's not like that shit is impossible to do in C.

Name: Anonymous 2012-05-19 21:58

>>16
They're not checked
What?

Name: Anonymous 2012-05-19 23:06

>>18
Learn a static language outside the C family.

Name: Anonymous 2012-05-20 1:52

>>20
No, I'm asking why you believe C++ types can't be checked.

Name: Anonymous 2012-05-20 2:00

Everyone seems to be against C++ because of today's processor speeds. What is a good replacement for it? Java, Python?

Name: Anonymous 2012-05-20 2:23

>>20
non trivial C++ code typically ends up using casts to get things done, and unchecked casting breaks type safety. Castless C++ is type safe. And it might be powerful enough for a lot of things, but it is common practice to use casts instead of trying to engineer around the type system. Maybe this is due to a type system with limited expressive power.

Name: Anonymous 2012-05-20 2:23

>>21
Well hardware speeds are increasing at a nice rate but eventually that will hit a brick wall. Of course, we all might be dead by then so it probably won't matter. Till then, I say use whatever language gets the job done quickly, however messy that may be. If you want speed, you can rewrite it later.

Name: Anonymous 2012-05-20 2:24

>>21
ocaml could work.

Name: Anonymous 2012-05-20 3:28

>>22

#include <typeinfo>
#include <cstdio>

class a
{
    virtual void foobar()
    {
    }
};

class b : public a
{
public:
    void b_foo()
    {
        printf("is b\n");
    }
};

class c : public a
{
public:
    void c_foo()
    {
        printf("is c\n");
    }
};

void test(a& bar)
{
    printf("test %s\n", typeid(bar).name());
    b* p1 = dynamic_cast<b*>(&bar);
    if(p1)
        p1->b_foo();

    c* p2 = dynamic_cast<c*>(&bar);
    if(p2)
        p2->c_foo();
}

int main()
{
    test(b());
    test(c());
}



Oh shit nigger what is this black magic

Also http://en.wikipedia.org/wiki/Liskov_substitution_principle

Name: Anonymous 2012-05-20 3:34

Everyone seems to be against C++ because of today's processor speeds. What is a good replacement for it? Java, Python?
yes, programming languages have to run on a virtual machine, so of course you are so correct in choosing Java and Python, because these are VM languages, which do not compile but are rather interpreted on a software interpreter.

I really think weve done well on this thread, this is a major milestone, if we would just all use languages that ran on a VM we would see exponential productivity growth. Please make a link of this thread and email it to everyone you know is involved in the creation of software

Name: Anonymous 2012-05-20 3:37

>>26
how about you go and suck a homeless man's dick you fuckhead

Name: Anonymous 2012-05-20 3:56

>>21
D, Java, Erlang, Go are all replacements for C++.

Name: Anonymous 2012-05-20 3:59

>>28
shhh shhh shhh dont say D, you will spoil it for everyone
please moderators remove post #28, there is no such thing as a language that does by the letter D

please resume to VM programming languages

Name: Anonymous 2012-05-20 4:06

>>29
fuck you bitch get cancer

Name: Anonymous 2012-05-20 4:32

>>29

there's nothing stopping me from using a native code compiler for java or python, and there's nothing stopping me from using a virtual machine to run C++.

Name: Anonymous 2012-05-20 4:37

>>20
C++ has type checking, but I am not talking about (C++) type checking. You're talking about enforcing invariants that aren't relevant to C++'s type system. They can't be checked. There are other language families which can check these, and even make they relevant to the type system.

(Even if they were type-related, C++ is not a safe language by any means. The user can bullshit types all they like with the minimum of ceremony.)

Name: Anonymous 2012-05-20 4:57

>>32
Give a code example of something that "can't be checked".

Name: Anonymous 2012-05-20 5:00

>>25

and there is also the (c style cast) and static_cast<>(), which can be used for unchecked type casting, which is what I was referring to.

Name: Anonymous 2012-05-20 5:22

>>34
So don't use them if you want focus on type safety. What point are you trying to make? That programmers need to be protected from themselves?

Name: Anonymous 2012-05-20 5:30

>>35

I'm saying that there exists a feature in seeples that allows the programmer to sacrifice type safety. I didn't make a statement about the consequences of the feature. I don't have a point to make, and I don't feel the need to make one, but as a personal option, I think sometimes it is handy is you are sure what you are doing will work and not easily get invalidated by future changes.

But maybe there is a better way of doing it. Multiple dispatch takes care of a good portion of it.

Name: Anonymous 2012-05-20 6:28

>>33
Glossing over the fact that you can't really check types very well in the first place, and for the third time: everything that isn't a type can't be checked. You don't need an example, just take some code and at each part ask yourself "is this a type?" - if the answer is "no," then it is something that can't be checked semantically. Now you can make up all the examples you'd like. There are infinitely many of them and they exist in all C++ code.

You can't even conceive of a language whose type system can be used to check semantics, can you? For the third time: learn another language already.

>>35
This started when some jag said you could make C++ as safe as anything else. It's not about the need for safety, but the availability of it. Whether you (or I, or anyone) like it or want it or think anyone should have it is irrelevant at this point.

Name: Anonymous 2012-05-20 6:46

>>37
There are infinitely many yet you can't even give me an example? Hilarious.

Name: Anonymous 2012-05-20 8:19

I am a C++ pro, but I'm yet to visit a C++ con.

Name: Anonymous 2012-05-20 9:08

>>39
SO FUNNAY

Name: Anonymous 2012-05-20 9:08

>>38
If you can't separate the type semantics from the rest on your own an example just isn't going to help you. So quit trolling or quit being an idiot.

Name: Anonymous 2012-05-20 9:12

>>41
So quit trolling
Says the guy that is incapable of providing an example despite his claim that there are infinite possibilities.

Do you even know C++? Is that why you can't give an example?

Name: Anonymous 2012-05-20 11:09

>>33,38,42
I'm not >>37 but are you for real? I'm interested, give some C++ examples to...
• type check at compile time that pure function void lol()'s code and subcalls in that code is side-effect free or referentially transparent.
• type check at compile time that void lol() only throws(Z ...)'s code and the subcalls in that code only ever throws what lol()'s exception specification Z specified.
• check at compile time that a region of code is guaranteed to terminate, even if that chunk of code has to be pretty simple.
• Type check partially at compile time for moments of using arrays stupidly.
• type check partially at compile time by a contract, which includes preconditions, postconditions, invariants, and that variables derives only from some other known variables, also, the contract's conditions and invariants must be automatically passed down by inheritance to subclasses.

Name: Anonymous 2012-05-20 11:41

check my dubz

Name: Anonymous 2012-05-20 11:53

>>43
What a bunch of useless checks. Your functional bullshit is worthless.

Name: Anonymous 2012-05-20 15:41

>>45
get back to stepping through your debugger code monkey.

Name: Anonymous 2012-05-20 18:52

>>37
Glossing over the fact that you can't really check types very well in the first place, and for the third time: everything that isn't a type can't be checked.
Thats an understatement to say you cant check types well in C++ because C++ is an extremely weakly typed. By that I mean C++ only knows a variable is of a certain type because you assign it that type, it has no other way to find out the type. So whether there are only a few types or if you make C++ richly typed with encapsulating with classes and templates, it will still be a weakly typed language.

So this is where D comes in, D adds dynamic typing, type inference, garbage collection, safe and volatile sections of code. It does a lot of what >>43 layed out without having to do it all from scratch. This is why I crack up that everyone shoots down D for being just another gimmick language just because it was written by an unknown compiler writer. Everyone seems to have a religious devotion to C++ to the point that features to make the language safe become more complex than the base syntax by orders of magnitude. The only thing stupider than the devotion to C++ is all the people who crawl back into the C womb in reaction to what has to be done to make C++ safe.

Name: Anonymous 2012-05-20 20:20

>>47
Okay. Sure. Keep pretending you're employable, you no-talent leech on society.

Name: Anonymous 2012-05-20 20:32

>>48
keep pretending you are productive. Use your tunnel vision to prevent yourself from discovering better alternatives. Learn to live with problems, rather than employing known solutions for them.

Name: Anonymous 2012-05-20 21:12

>>47
D is shit, C++ is worse.  If it ain't Lisp, it's crap.  Lisp is shit.

Name: Anonymous 2012-05-20 21:26

>>50
whenever people list quotes of famous programmers who hate C++, its always these academics who have never worked in the commercial software industry and only do AI research alone in their office. The two exceptions being Linus Torvalds and Ken Thompson who are both systems programmers, systems programming being the only area C holds an advantage over C++

Name: Anonymous 2012-05-20 21:58

>>50
Youve won /prog/ after a few weeks of fighting it i give in.  Im going to learn lisp

Name: Anonymous 2012-05-20 22:17

>>52
I learned Lisp because of /prog/ and I haven't used it for anything but toy programs.

Name: Anonymous 2012-05-20 23:01

>>51
commercial software industry
stopped reading right there.

Name: Anonymous 2012-05-21 0:02

>>52
ok, but don't have high expectations.

Name: Anonymous 2012-05-21 0:10

>>55
I expect it to be shit

Name: Anonymous 2012-05-21 0:50

Call me a newbie, but what is Lips best used for anyways? AI?

Name: Anonymous 2012-05-21 1:05

>>57
Lips are good for talking, eating, and kissing. Though kissing is not something a /prog/rider would use them for.

Name: Anonymous 2012-05-21 1:59

>>45
It all started with a claim that C++ could be made as safe as any other language.

Name: Anonymous 2012-05-21 2:25

C++ is already too large and complicated for our taste.
- X3J16 (C++ standardization committee)

I really like C++. I was instantly attracted to it back in 1986, and created the first native C++ compiler (Zortech C++).
- Walter Bright

Name: Anonymous 2012-05-21 10:25

No Unicode.
No networking.
No default GUI toolkit.
Piss poor, incomplete implementations, all of them.

Use only for systems programming and game development. Any other uses are sadomasochism.

Name: Anonymous 2012-05-21 10:42

C++11 fixes the major issues that C++ had. It doesn't really take longer to write (than C#, Java, etc.) if you know what you're doing, and you get all the efficiency of C++.

Name: Anonymous 2012-05-21 16:08

All play and no work makes Jack a wise man.

Name: Anonymous 2012-05-21 16:41

>>61
Please understand that these things are outside the scope of the language (except UNICODE, since they have a string class, and I believe this has been implemented half-assedly in C++11). That said, if C++ just had a nice set of standard namespaced libraries you could statically link to to support these things, like Haskell for example, it would eliminate one of the worst problems with C++. After that of course, there's still the godawful syntax and shit heaps of duplicate functionality.

Name: Anonymous 2012-05-21 17:59

Rei.

Name: Lambda A. Calculus 2012-05-21 19:02

>>64
For me, it's UMENA HASKAL-CHAN!!

Name: Anonymous 2012-05-21 19:02

Rei.

Name: Anonymous 2012-05-21 19:43

>>61
it's called third party libraries you dickfuckcuntmong.

Name: Anonymous 2012-05-21 20:48

C++ a shit

Name: Anonymous 2012-05-21 23:08

>>68
obvious Java/C# Enterprise Programmer who expects all libraries to be built in to the language implementation

Name: Anonymous 2012-05-22 8:22

bumpu pantsu

Name: Anonymous 2012-05-22 8:22

Cons: no cons cell

Name: Anonymous 2012-05-22 8:34

bumpu pantsu

Name: Anonymous 2012-05-22 8:54

Rei.

Name: Anonymous 2012-05-22 9:32

bampu pantsu

Name: Anonymous 2012-05-22 9:43

bampu pantsu

Name: bampu pantsu 2012-05-29 5:03

bampu pantsu

Name: Sgt.Kabu絃ꪉkimanM笽 2012-05-29 13:35

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy

Don't change these.
Name: Email:
Entire Thread Thread List