Page 4 of 4

Re: learning c/c++

Posted: Wed Jun 12, 2013 11:40 am
by Love4Boobies
Are you sure that was written by a human and not a computer program?

Re: learning c/c++

Posted: Wed Jun 12, 2013 9:06 pm
by Kazinsal
Not at all, but it's still a Malbolge program! :)

Re: learning c/c++

Posted: Wed Jun 12, 2013 10:34 pm
by BMW
Blacklight wrote:
Love4Boobies wrote:
BMW wrote:No programming language is really useless, it just depends what you use it for.
On what grounds do you make this claim?
On the grounds that he has clearly never worked with Befunge or Malbolge.
Nope, you're right.

However I still don't think they are useless - they have some amusement value.

Re: learning c/c++

Posted: Sat Jun 15, 2013 12:07 am
by Mikemk
BMW wrote:However I still don't think they are useless - they have some amusement value.
By that token, zits/pimples al over someone's face in middle school are useful because they give bullies a reason to make fun of the person. Are they actually useful? I think not.

Re: learning c/c++

Posted: Sat Jun 15, 2013 6:09 am
by thepowersgang
Since this has already gone really far off track, I might as well have some fun.

Languages like Brainf*ck, Malbolge and other esoteric languages are designed to be difficult, strange or just plain funny. Either for entertainment value or as an experiment on how close to white noise you can get (or in some cases, how code can be a nice picture - See Piet). They all serve a purpose, even if that purpose is quite trivial.

Re: learning c/c++

Posted: Tue Jun 18, 2013 2:57 pm
by technix
Griwes wrote:If you know C# and Java and want to write something in proper C++, unlearn everything you've learned. Same holds for C.

C and C++, when used without standard libraries, are pretty similar. The main differences are:
1) You have real constructors and destructors, so RAII is possible.
2) You have templates (never underestimate a compile time Turing-complete language!).
3) You have easy to use polymorphism.
4) You have namespaces.
5) You have overloads.

So, basically, to write a *kernel* in C++ (as opposed to writing it in C), you'd have to learn at least those things *and* C. Of course, knowing more things in detail can be really helpful, so I would advise also writing some userspace applications in modern C++; also, there should be some serious style differences between code written in C and in C++.
You really don't need to unlearn anything - I had multiple language switching events, from Visual Basic to C# to Java later to C and Objective-C (I still hate C++) there is not much issue. Actually the object-oriented background of mine helped me to build OS GDT and IDT in an object-oriented way - I treated GDT and IDT as vectors of objects of type gdt_s and idt_s and I even manipulate them with "instance methods" like gdt_addItem(gdt_s). Check out the books on object-oriented programming in C and you will find migrating what you have learned in C#/Java to C easy.

Re: learning c/c++

Posted: Wed Jun 19, 2013 3:19 pm
by Griwes
You totally missed my point; to write modern C++, you cannot write Java or C# in it, which you will do without unlearning them.

But you weren't talking about C++, since you hate C++, and you even explicitly said "migrating to C" later on, so your post brings nothing into the discussion - or at least is totally unrelated to my post you quoted.