Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's the neat thing about C++. You don't have to use any of it that you don't want to.


That'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++.


[flagged]


Do you get a dopamine hit out of this?


Nothing about a dopamine hit out of it, no. Something about _main being an undefined symbol. Are you familiar with that error message?


How 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.


> 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?


It doesn't link. Something about undefined symbol _main. Can you help?


It 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?


Oh, 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?


No, 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.


But I don't want to use an assembler.

Well, fine. Doesn't build. Says somehow about undefined symbol _main


Funny, I haven't told you anything about the architecture yet. But as you don't want to use the tools anyway and it is only a three byte program for the target machine, the good news is that it can quite easily be assembled by hand. Now, back to the C++ problem, any idea what the next step to get us past the issue?


> that guy asked Stack Overflow how to make gcc compile his .png

Do you have a link to this? All the search results I'm getting are related to libpng.


I can't find it with a more specific search on SO, maybe it was deleted.

The question was like: I wrote "hello world" but I get some compile errors, followed by an image embed of a handwritten hello world program, followed by a compiler command where the input file had a .png extension and an error related to the compiler not being able to read PNG files, followed by quoting the part of the standard where it says the input file shall be readable text and this is obviously readable text because I can read it.


I'll take things that never happened for $500, Alex


I searched harder, just for you.

https://stackoverflow.com/questions/5508110/why-is-this-prog...

How would you like to send the $500? Monero is acceptable.


> I searched harder, just for you.

I know this one! How did you waste your time?

> How would you like to send the $500?

Simpsons already did it. Well, at least it is a lot funnier than that PNG thing.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: