7
nitwhiz
3y

How is C and C++ development done in reallife ffs?

Like, you got no ecosystem whatsoever, just thousands of build chains. How does this work?

Comments
  • 5
    There's always that one guy in the department who's a cmake wizard who writes a working cmake template and then everyone relies on that

    And then everything breaks if you need to port from Windows to Linux or whatnot
  • 3
    What do you mean no eco system? Everything runs C and there's tons of libraries
  • 2
    He means there's no tools to hope your hand and do it for you.

    Imo those tools isolate you from how things work, and make you a worse developer. And I think the old school mentality reflects that and is the reason that these tools aren't popular here.
  • 7
    Just learn make, for the most part adding libraries is just installing them on your system, or giving your compiler the include and source paths and possibly add a flag or two.

    I find it rather fun to know what exactly Im doing
  • 1
    Just link the libraries
  • 0
    @matt-jd @lungdart so it's completely normal for you two to just copy sources from GitHub into your own source tree, so you have the library available?

    @iiii how would i "just link" a github repo?

    Or is it like i pull the repo, build the objects, tell my project where those headers are, and link the objects in my project?
    If yes - how am I going to publish this, am i telling people to do so, too?
  • 0
    @Hazarth oh fuck you answered this, too, at least kind of.
    Well then, imo that's just weird, because after the 15th project these manual steps must be fucking annoying?

    But i guess it's just the way it is.
  • 2
    @nitwhiz yes but not at the level you may be used to with other environments

    Most things you'll code yourself. You won't go find an OOP wrapper for an api for instance, you'll just use curl and do it yourself.

    Any third party libraries should be limited to ones that are commonly in OS package managers, if you really need something else (like a multi consumer Multi producer lockless queue) you'd look for a header only implementation and put it in the include path of you're project hierarchy.

    Within your project you should have the following directories:

    src
    bin
    lib
    include
    docs
    test

    Your makefile will include both the project and system directories, and link to the project and system lib directories and compile to bin. Once successful it should copy everything in bin lib and include to the system, docs to man pages.
  • 0
    @lungdart i see and i totally see especially this "writing yourself" working when developing binaries for linux and windows, but in embedded this must just suck?
  • 2
    @nitwhiz it's what I grew up on, I actually hate using tools like npm and pyenv because I want to manage my system myself.

    I can't see installing an entire os and an ecosystem of tools on an embedded device just to not have to write a bit of code. Just write the code, and grow your environment managing skills!
  • 1
    @lungdart that's extremely inefficient, isn't it? I think you're missing the point of missing standardization and ecosystems for languages leading to the wheel being invented a good 200 times a day - costing you the whole day, instead of just a few minutes.

    and by embedded i mean coding C or C++ and compiling it for an embedded platform, e.g. an arduino, espressif, ... (even though espressif actually got a component system. and it's just weird.)
  • 1
    C is 50 years old. Unix is older. You need to remember these were revolutionary technologies and methodologies for doing things.

    These methodologies aren't going to change because updating them will inevitably lead to deprecation of platforms.

    One of the reasons c is so portable and used on many bare metal architectures because of this. It may be inefficient to write your own garbage collector or thread pool, but these custom tools are already in use for the last two generations and still being supported. They're not going to go away to make the environment more modern.

    C isn't for quick web dev. It has a use case and it's very well suited for it. It doesn't need to change.

    If you need to quickly prototype an iot proof of concept, use Python. If you need to squeeze extra performance out of a real time process scheduler, use c.
  • 0
    @lungdart wait what, writing something that downloads the source, compiles objects and has them ready at location x to be linked against (aka the things you do manually) would deprecate stuff?

    I think you take this a bit personally, I really like C, it's actually the first language I started with. Also, I'm a big fan of writing things myself, just because I really love coding.

    But I don't see any argument against having a registry for sources where you can pull them - as dependencies - of your code.

    I'm just pissed off about the state of the art when it comes to development for the ESP-32. The manual steps involved are stupid, hard to remember, and nothing that I, as a coder, should have to worry about. imho.

    As if you need to be a mechanic to drive a car. You don't give a shit about the inner workings of them when you drive, do you?

    Oh and for python - yeah. That specific kind of ecosystem is just fucked up, no wonder you don't like it. It just doesn't work.
  • 1
    @nitwhiz for embedded it's the same except you should statically link instead of dynamically depending on which embedded thing there are different tools. As embedded is a very diverse domain there are lots of ways and depends on what, some systems run Linux. Esp is good for prototyping you can program it with arduino studio thing, msp430 and Pic has their own studio as well which will probably help you with the libraries.
  • 1
    @nitwhiz you're not a driver upset you need to be a mechanic to drive, your an engineer upset you need to know how a car works to build one.

    There's no c source repo catching on because it's the job of the operating system to handle library dependencies and the sysadmins who are responsible for those environments.

    It's not that these tools wouldn't have their use do nobody makes them. These tools exist and people who write c don't find them useful and don't use them. It's a different market, it's nothing personal. The modern development philosophy doesn't fit the primary use cases for the c language.

    If you don't believe me, go make another c package management system and watch it never become popular.
  • 1
    @nitwhiz

    I guess the thing is, that C/C++ code is very low level and close to the architecture and operating system. There's no higher level virtual machine like in Java or interpreter engine like in javascript or python. CMake tried to solve this by having individual modules... but those modules are still a pain to write, find, configure and use in some cases... maybe it boils down to C/C++ programmers just being obsessed with options and parameters or something... I didn't really look deeply into this and just accepted that writing my own makefiles means I know how the system builds, what it looks for and where it places things on *all* supported systems. Maybe C/C++ programmers are just weirdly patient that way? dunno...

    however there is a bit of a light at the end of the tunnel as the C++20 standard now includes modules... those should somewhat simplify library delivery and usage though I'm not particularly thrilled about them just yet, haven't played with it so far.
  • 1
    @Hazarth on a side note I think it's quite funny that c++ keeps updating and adding and the standards being used while the latest widely adopted c standard is old enough to have graduated from college
    (this was written in a jokingly way)
  • 1
    @Hazarth I'd be really happy if c++ allowed ABI breaks every update. That and c superset compatibility really shackles it down.
  • 0
    I use Vcpkg for school projects and my supportive TA give back wisely worded F**k you as feedback cause they can't follow simple instructions on Vcpkg doc to install packages.
  • 0
    @nitwhiz download the contents then link. And you provide the library you've linked to. Or if you're publishing to Linux you can make a dependency for your package.
  • 1
    @matt-jd the latest released C standard is C17. 17 as in 2017. And the latest before that was C11.

    C is not that out of touch as you could think.
  • 0
    @iiii it is a joke but ansi c is 99 iirc and I use c99 as well, not sure what they added in the new ones even
  • 0
    @matt-jd ANSI C is all of them. It's a family of standards.
  • 0
    @nitwhiz C and C++ projects tend not to have very dependencies. It's different from a lot of other languages.
  • 0
    Prepare to get Rust-ed 😁
Add Comment