6 ms·
C has very low entry level, providing that you have some knowledge about memory management. When, as a Java developer, I had to quickly deliver some exchange co
by p0w3n3d 9mo ago
C has very low entry level, providing that you have some knowledge about memory management. When, as a Java developer, I had to quickly deliver some exchange connector using given .h and .so, I chose C, because C++ had too high entry level. If C is a sharp knife, C++ is a rotating pell post full of sharp knives. You can cut yourself even if you think you're safe.
But I find string management in C awful and would like to borrow it from C++. Only the string management
- direwolf20 9mo agoThat's the neat thing about C++. You don't have to use any of it that you don't want to.
- 9rx 9mo ago[flagged]
- direwolf20 9mo agoDo you get a dopamine hit out of this?
- 9rx 9mo agoNothing about a dopamine hit out of it, no. Something about _main being an undefined symbol. Are you familiar with that error message?
- direwolf20 9mo agoHow did your equivalent assembly program without a definition of _main to? You're doing that thing. I think it's called "trolling". It goes like "hurr durr, they said take one, but they wouldn't let me take one plate" or "hurr durr, I filled my gas tank with nitrogen, which is a gas, but my car doesn't go" or "hurr durr, they said C++ features are all optional, but I don't want to use letters, how can I write C++ without using letters?" At least when that guy asked Stack Overflow how to make gcc compile his .png, it was actually funny.
- 9rx 9mo ago> your equivalent assembly program Right now, hlt jmp $0 I intend to add more later, of course, but I until I get past this hurdle I am unable to start. Does that help narrow things down for you?
- direwolf20 9mo agoIt doesn't link. Something about undefined symbol _main. Can you help?
- 9rx 9mo agoIt doesn't need to link. That is the complete program. Are you suggesting I need to pass a flag to the C++ compiler to disable the linker? How do I do that?
- direwolf20 9mo agoOh, I see what you meant now. I don't think it works: ./test: line 1: hlt: command not found ./test: line 2: jmp: command not found Do you get a dopamine hit out of this?
- 9rx 9mo agoNo, that is right, assembly doesn't work in what looks like the output of a Unix shell. Assembly is intended to be input to an assembler. Easy mistake to make, I suppose.
- direwolf20 9mo agoBut I don't want to use an assembler. Well, fine. Doesn't build. Says somehow about undefined symbol _main
- 9rx 9mo ago
- IshKebab 9mo agoThat's only really true for solo projects. For example I worked in a company on a C++ SDK for a while and it was written by one of those clever people who has zero taste in software development and thinks you have to use GoF patterns everywhere. The god object was a CRTP inheriting from about 20 templated base classes. I spent about a year trying to sort out that mess and then quit. To be clear I would still always pick C++ over C because C makes simple stuff (strings and containers mainly) waaaay more painful than they should be. But I also don't really agree with the "C++ is simple - just don't use the complex bits!" argument. Anyway it's kind of academic now because 99% of the time Zig is an obviously better choice than C and Rust is an obviously better choice than C++.