Author Topic: C++ , likes/dislikes?  (Read 11649 times)

0 Members and 1 Guest are viewing this topic.

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: C++ , likes/dislikes?
« Reply #15 on: September 19, 2005, 06:57:39 pm »
gcc!

A C++ compiler can also compile C code. 

Offline MyndFyre

  • Boticulator Extraordinaire
  • x86
  • Hero Member
  • *****
  • Posts: 4540
  • The wait is over.
    • View Profile
    • JinxBot :: the evolution in boticulation
Re: C++ , likes/dislikes?
« Reply #16 on: September 19, 2005, 07:56:02 pm »
MSVC is free too :P  http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&DisplayLang=en

Incidentally, static variables work differently in C than C++.  Static variables in C still had scope, typically at function-level:

Code: [Select]
void doSomething(int a) {
  static int num;
  num += a; // probably will generate a compiler error, as num is unassigned.
}

In C++, "static" variables are supposed to belong to a class as opposed to an instance of the class (like in Java and C#).
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Our species really annoys me.

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: C++ , likes/dislikes?
« Reply #17 on: September 19, 2005, 08:03:35 pm »
MSVC is free too :P  http://www.microsoft.com/downloads/details.aspx?FamilyID=272be09d-40bb-49fd-9cb0-4bfa122fa91b&DisplayLang=en

Incidentally, static variables work differently in C than C++.  Static variables in C still had scope, typically at function-level:

Code: [Select]
void doSomething(int a) {
  static int num;
  num += a; // probably will generate a compiler error, as num is unassigned.
}

In C++, "static" variables are supposed to belong to a class as opposed to an instance of the class (like in Java and C#).

Yeah, the example I gave, and the one that RaBBiT wanted, was in a class.  So that's C++. 

Offline MyndFyre

  • Boticulator Extraordinaire
  • x86
  • Hero Member
  • *****
  • Posts: 4540
  • The wait is over.
    • View Profile
    • JinxBot :: the evolution in boticulation
Re: C++ , likes/dislikes?
« Reply #18 on: September 19, 2005, 08:07:59 pm »
It wouldn't make sense to make a globally-static variable outside of a function in C, because that was the beauty of static variables; they retained their value from one function call to the next.
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Our species really annoys me.

Offline Hauptmann Raub

  • Newbie
  • *
  • Posts: 21
  • I'm new here!
    • View Profile
Re: C++ , likes/dislikes?
« Reply #19 on: September 20, 2005, 06:14:16 pm »
I dislike MSVCC.  The port of GNU MingW+MSYS for Win32 is an awesome compiler, which can be extended to compile C++, Java, and Assembly (it comes with C compiling).  I really like it.

One thing I dislike about C++ (mostly due to learning VB6 first), is that I can't use a globally accessible variable (IE: class main has a value, but I need to pass an instance of main to every other class so that I can access 1 variable).  It's very annoying, but I've gotten somewhat used to it.
You're talking about a "static" variable. 

Code: [Select]
class A
{
public:
  static int a = 3;
};

...........
A.a = 5; // no instance of A! Just the class itself!

I don't think that'll compile, since I seem to remember that C++ has something stupid about static variables, but yeah. 

Anyway, is the book on C or C++?

C is invaluable to learn.  Once you know C, any other language is fairly easy.  If you ever plan to do anything low-level, like hardware programming or even game hacks, you're going to be doing it in C.  C has been around for 25 years, and isn't going anywhere. 

I love how C code looks.  It's nice code, if you know it well you can do anything.  You can even do object oriented-style programming in C, and I like doing it in C a lot better than C++.


C++, I don't like.  It's shambled together on top of C, and makes thing more complicated.  In trying to maintain their reverse compatibility with C, they added a lot of kludges and workarounds that make code really ugly (like static class variables have to be initialized outside of the class, or something like that).  C++ code tends to be much more mangled and ugly than the equivalent C code.  I very much dislike C++.  If I intend to do something object-oriented, I use Java.  Java wasn't trying to maintain reverse compatibility, so it's a lot nicer. 

It's like comparing IA-64 assembly to HP-Tru64.  HP-Tru64 was designed and built to be 64-bit.  So it's faster and cleaner.  IA-64, on the other hand, maintains reverse compatibility with 32-bit and 16-bit, and, as such, is pretty ugly. 




Anything other than static integral values need to be defined outside the class.

Offline Joe

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: C++ , likes/dislikes?
« Reply #20 on: September 20, 2005, 07:58:16 pm »
cpp (the GNU thing), MSVC++ 98 (talk to xar (IRC)), Bloodshed Dev-Cpp
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline mfqr

  • Newbie
  • *
  • Posts: 25
  • I'm new here!
    • View Profile
Re: C++ , likes/dislikes?
« Reply #21 on: September 24, 2005, 03:46:24 am »
Quote
What are some likes and dislikes from the people that code it?
Likes:
- Fast and small binary files
Dislikes:
- After learning VB, this is hard++.

Quote
Should I learn another programming language before jumping into this one?
I think Java is a lot easier than C++, yet uses the same basic syntax, so you should probably learn a bit of that first.

Quote
What's a good compiler I can use on a WinXP box?
I settle for MSVC++.

yeah from what I've read, cpp is fast, but cant the binaries sometimes get really big too? I guess i'm sort of comparing this to asm. is it true that some asm binaries can be down to bytes even? like 25 bytes?

Offline MyndFyre

  • Boticulator Extraordinaire
  • x86
  • Hero Member
  • *****
  • Posts: 4540
  • The wait is over.
    • View Profile
    • JinxBot :: the evolution in boticulation
Re: C++ , likes/dislikes?
« Reply #22 on: September 24, 2005, 04:57:41 am »
Yeah that's true, but rarely will a system load a code-only binary except at boot time (files such as ntldr are code-only).  They're hard to trust, and the extra information helps to keep the system safe.
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Our species really annoys me.

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: C++ , likes/dislikes?
« Reply #23 on: September 24, 2005, 11:54:54 am »
Sure, an assembly file can be 25 bytes, but it's useless. 

Any program (assembly or c++) has to call library functions to be useful.  Often, the libraries are included in the executable, which makes it pretty big.