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

C++ is not back

Name: Anonymous 2012-12-02 11:40

http://simpleprogrammer.com/2012/12/01/why-c-is-not-back/

Some interesting points about C++. I think next version of C++ should remove 80% of the language.

And no, C is not an option. Lack of RAII and other "advanced" functionalities will result in terrible bugs.

And no, D is not proper replacement. GC is shit.

Name: Anonymous 2012-12-04 4:13

>>37
Win32 is a C API, and the vast majority of the NT kernel is written in C [1].  You can indeed write kernel mode drivers for NT in C++ [2], but this is of limited usefulness because one must dispense with many of the defining features of the language (templates, exceptions, RTTI) in order to get things done. Even RAII is of limited application because kernel destructors can often fail in myriad ways.

I'm not at all convinced that it's worth it to switch from C to C++ for kernel code. For a green-field project, a C++ subset might be a smidge nicer to use, but real world codebases like the Linux kernel have already implemented so many of the niceties in plain C that there's no clear benefit to switching.


[1] http://discuss.fogcreek.com/joelonsoftware/default.asp?cmd=show&ixPost=28914
[2] http://msdn.microsoft.com/en-us/library/windows/hardware/gg487420.aspx

Name: Anonymous 2012-12-04 5:05

>>41
The API is C for MAXIMUM compatibility, it doesn't say anything about the implementation language. Templates, exception, RTTI either didn't exist yet or had only bad/expensive implementations (remember that this is late 80s/early 90s language and compilers).

Most kernels reinvent object orientation anyway (Linux VFS layer just to give a lel randum example), so why not save some work and use a language that supports the features from the start?

Name: Anonymous 2012-12-04 5:56

>>14
The Symbian kernel, written completely in C++, is pretty popular. Ot at least it used to be. That amounts to hundreds of millions C++ kernels shipped. That's 8 orders of magnituds more than GNU/Hurd or whatever you neckbeards endorse here.

Name: Anonymous 2012-12-04 5:56

>>41
I agree that there is not much point in rewriting current kernels in from C to C++.

However, I think that if starting to create new kernel from scratch, it would be very useful to use C++ instead of C. And I also think Linux should make it easier to develop drivers in C++, or maybe allow the use of C++ in certain parts of the kernel itself.

Name: Anonymous 2012-12-04 5:59

>>42
Because you truly gain nothing.

Name: Anonymous 2012-12-04 6:17

>>43
The Lisp machine kernel, written completely in lisp, is pretty popular. Ot at least it used to be. That amounts to hundreds of millions of lisp kernels shipped. That's 8 orders of magnitude more than Linux/Windows NT or whatever you neckbeards endorse here.

Name: Anonymous 2012-12-04 6:51

>>46
The Losethos kernel, written completely in AutismC, is pretty popular. Or at least it used to be. That amounts to hundrends of billions of AutismC kernels shipped. That's 8 orders of magnitude more than Linux/Windows NT/Symbian OS/Lisp OS or whatever you enterprise programmers endorse here.

Name: Anonymous 2012-12-04 7:27

>>45
Just not having to rely on macro garbage to make your fake objects palatable is an improvement.

Name: Anonymous 2012-12-04 7:55

The next version of C++ should remove 100% of the language.

Name: Anonymous 2012-12-04 7:55

>>47
You don't have any friends in your class.

Name: Anonymous 2012-12-04 8:04

And no, C is not an option. Lack of RAII and other "advanced" functionalities will result in terrible bugs.
Only if you're careless.

Name: Anonymous 2012-12-04 8:41

>>51
Yeah, only if I'm careless, or any of the developers that touch the code after me. Basically only if there is any careless developer in the company, or will be. So I can just use C, because every developer touching the code is perfect.

Name: Anonymous 2012-12-04 8:44

>>51
lel 99.9999% of the bugs in C applications are forgetting to free le resource after usage. and releasing resources in C can only work well if you have only 1 return clause per function.

Name: Anonymous 2012-12-04 9:17

>>53
But that's good policy anyway.

Name: Anonymous 2012-12-04 9:18

>>53
lel, le
stop that or people will start taking it seriously

Name: Anonymous 2012-12-04 9:49

C++ facilitates objection-oriented programming (OOP).

Name: Anonymous 2012-12-04 11:42

>>56
OOP doesn't solve any hard problems, learn to structure and discipline, it's easy. OOP wouldn't help anyway, if you believed that.

Name: Anonymous 2012-12-04 12:15

>>56
So does C.

Name: Anonymous 2012-12-04 12:23

>>57
Wow, a real-life retard

>>58
I do not object to using C where it belongs.

Name: Anonymous 2012-12-04 12:36

>>59
You're having hard problems that can only be solved by OOP?
Lel.

Name: Anonymous 2012-12-04 12:48

>>60
Troll harder!

Name: Anonymous 2012-12-04 13:06

C++ with OOP, what could go wrong?
handicapped polymorphism
undefined as shit C
implicit needles
trashing cache
hit a wall? rewrite in data-oriented C subset

RUBY AS FUCK

Name: Anonymous 2012-12-04 13:15

>>61
A thought-terminating cliché from you, but it's not related to me and my question. Infact it did not even imply your silly rebuttal. To me that was unexpected. There are problems where OOP is a suitable method and if you would have mentioned at least one of them I would be prepared to give alternative methods that are at least to me better since they do not imply the need of an entire programming language, an imperative language would do just fine. But I'm talking with my self since you have nothing else to add, so I'll stop because it is boring me or at least saddening me.

Name: Anonymous 2012-12-04 15:33

>>37
wrong, it is written is ANSI C

Name: Anonymous 2012-12-04 15:34

>>37
Wrong, it is written in ANSI C.

Name: Anonymous 2012-12-04 15:38

>>15
No, not really.

Name: Anonymous 2012-12-04 15:43

Alan Turing must be turning on his grave with the amount of gotos the windows NT kernel have

Name: Anonymous 2012-12-04 22:42

>>67
That joke only works with Dijkstra, don't know if I should be glad or sad no one picked it up.

Name: Anonymous 2012-12-05 1:20

The problem with saying deliberately stupid shit for attention is that eventually it becomes impossible to tell /prog/ apart from people who believe stupid shit.

Name: Anonymous 2012-12-05 1:23

>>68 what else would you expect from /g/
>>69 maybe /prog/ isn't that bad after all. We are just pretending to be terrible to constantly troll ourselves.

Name: Anonymous 2012-12-05 22:39

>>54
Good policy, made incredibly annoying by the prescriptions against goto that frequently accompany it.  Sanity demands one or the other, but not both.  It does not help readability at all to use extra flag variables to direct transfers of control.

There is nothing wrong with this:

int func1(int *f, int x)
{
    char *buf;
    int err;
    int ret;
   
    ret = 0;
   
    buf = malloc(4096);
    if (!buf) {
        ret = -1;
        goto out1;
    }
   
    err = func2(buf, x);
    if (err) {
        ret = -1;
        goto out2;
    }
   
    /* Et cetera... */

    *x = func4(buf);
out2:
    free(buf);
out1:
    return ret;
}


The alternative requires creating a new function or nested control structure every time an error code is checked.  You can't do this more than 2-3 times without wrapping code off the screen, which leads to creating lots of pointless little functions.  The result is much harder to read than just using goto to break out when an error is encountered.

Name: >>71 2012-12-05 22:42

*x = func4(buf);

Whoops.

*f = func4(buf);

Name: Anonymous 2013-08-31 18:28


It seems like most of our names for colors come from our German roots (blue/blau, green/grün, red/rot, etc.). But yellow is gelb in German, amarillo in Spanish, jaune in French, and giallo in Italian. I suppose the Italian seems closest, but perhaps they all have something in common?

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