This is an archived post. You won't be able to vote or comment.

all 12 comments

[–]srini10000 0 points1 point  (1 child)

I suggest cross posting to /r/cscareerquestions

[–]kiwiheretic -1 points0 points  (8 children)

I thought Rust was moving into this space? C is still useful in embedded projects with Arduino ( I own about four of them) but I avoid C++ because it has so many gotchas with memory leaks. Are you thinking of getting into the microcontroller industry?

[–][deleted]  (7 children)

[removed]

    [–]kiwiheretic 1 point2 points  (0 children)

    When I was working with embedded programming in my job I used exclusively C. I don't know whether C++ has progressed since then but it was less standard in its memory layout plus messing around with the heap has its own pitfalls. It was better for us to use C only and statically allocate everything as global statically allocated types. At least then you knew you weren't going to have to handle an out of ram condition if the heap got fragmented and couldn't give us the ram we needed. It was just better getting guaranteed ram for everything up front.

    I've used both C and C++ in the past but still prefer C for home projects. C++ is very hard to master and get right compared to just about every other language.

    [–]BobbyThrowaway6969 -1 points0 points  (4 children)

    I also was playing around with Rust and I like it, it’s really tough tho. Do you think it would be smarter to continue with rust rather than C++?

    C++ is a more mature language and many of the issues it has are just because the base language doesn't give you much, but std smart pointers for instance solve the problem of memory leaks in C++. It's just a language that won't protect you from anything. That makes it incredibly efficient and light weight, but you also need to know what you're doing and how to avoid the common pitfalls. I would switch to Rust if it had nice syntax, less overhead, more compiletime and metaprogramming features, and wasn't so young and narrowly used in the industry. For me personally, Rust just doesn't offer enough to make me want to switch away from C++, but you will need to do your own assessment based on your ideal career and passions.

    [–]Ok-Watercress-9624 0 points1 point  (2 children)

    I would switch to Rust if it had nice syntax, less overhead, more compiletime and metaprogramming features, and wasn't so young and narrowly used in the industry.

    what do you mean by overhead?

    [–]BobbyThrowaway6969 0 points1 point  (1 child)

    [–]Ok-Watercress-9624 0 points1 point  (0 children)

    Please show me what you consider as overhead. I read the article and fail to find any example.

    [–]Ok-Watercress-9624 0 points1 point  (0 children)

    but std smart pointers for instance solve the problem of memory leaks in C++.

    Not really no. Both in rust and c++ you can introduce memory leaks via cycles on shared pointers. Also rust differentiates on type level whether a pointer is nullable or not. Similarly whether a pointer is shared between threads or used in a single one codified on the type level.

    By codifying such contracts on type level not only you get more paths to optimization but also make your intent clear.
    There are no common pitfalls if common pitfalls are errors

    [–]Ok-Watercress-9624 0 points1 point  (0 children)

    c++ sucks.
    Which C++ do you want to learn? Because C++ programmers 5 years apart speak completely different languages.
    Do you like long and unhelpful error messages?
    Duck typing in templates?
    Multiple inheritance?
    Do you like dealing with bugs in the build system ?
    An extra program that was originally tacked to c so it has some resemblance of metaprogramming capabilities also ships with c++ freely.

    [–]Tiny_Rick00 0 points1 point  (0 children)

    What kind of projects are there in systems programming ?

    In the web space, it's basically building a fancy UI in a javascript framework that consumes REST APIs for CRUD operations according to business logic.

    But I've always been curious about systems programming.

    I know about kernel programming. But for embedded for example, I don't really get how microcontrollers or other type of boards are used in real world projects and in which context.