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

[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

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