Welcome, Guest. Please login or register.

Author Topic: Anti C++ sentiment?  (Read 13395 times)

Description:

0 Members and 1 Guest are viewing this topic.

  • Guest
Re: Anti C++ sentiment?
« Reply #29 from previous page: January 28, 2003, 10:49:26 AM »
I LOVE C++!
I am software developer and C++ is my favorite language. The more I learn about it the more I love it. And more languages i learn to program in, the more I recognize how much C++ is better than anything else. (Have you ever programmed in PowerBuilder? It's horrible.)
I like Java too, espacially this reflection thing and the ability to have native 64 bit integer support.
But as DaveP stated you can create your own dialect of C++ and implement other datatypes.

The only thing I would prefer is an ISO norm for variable names that says: [vartype][bits] e.g. int8, int32, int64 instead of char, short int, long, etc. and an extended support for string objects so that companies such as M$ don't create their dialects in their IDEs and you have a lot of work to be IDE independent. The CString class in the MFC is a good string class, but as I want to be as platform independent as possible when programming GUI apps I must do workarounds to read strings from controls when not using CString but the string class of the STL.

 

  • Guest
Re: Anti C++ sentiment?
« Reply #30 on: January 28, 2003, 10:58:17 AM »
@Waccoon:
Quote

mdwh2 wrote:
Quote

All I know is, when I complile a C program with a C++ compiler, the program turns out huge.  I mean, just for fun I wrote Hello World in MSVC with default values, and it compiled to over 250K.  WTF?  Or is that just because it's Microsoft?

But what are you comparing to? And is it the exact same hello world program (ie, still using stdio and no iostream)?

Using Amiga gcc, compiling the same hello world program produces a program size 2704 bytes in C mode, and 2716 bytes in C++, so hardly an unreasonable difference, and I guess what you get is just because it's Microsoft.

In Borland CBuilder, compiling a Hello World program using stdio/printf takes 54272 bytes, but using iostream/cout takes 111616 bytes. So there is a significant difference here, but down to using different libraries, and not necessarily just that it's C++.


It also depends on which compile method you use. If you compile your program in DEBUG mode, the source code will be filled with debug trackings by the M$ C++-compiler. Try compiling your project once in DEBUG mode and once in RELEASE mode and you'll see the difference.
As mdwh2 already said, it also depends on which libraries you use. When I include stdlib, stdio and iostream the programm is much bigger than when I only include iostream, because the include macro, includes the headers into the code before compiling it and than your libraries have to be linked and as result you get binary code that's much bigger than your simple C++ source code file.
 

Offline trgse

  • Full Member
  • ***
  • Join Date: Jul 2002
  • Posts: 150
    • Show only replies by trgse
    • http://hem.fyristorg.com/TRG/
Re: Anti C++ sentiment?
« Reply #31 on: January 28, 2003, 11:01:47 AM »
Quote

1. From the language point of view it is an improved Java, for M$,  years of experience with Java were enough to see, what to improve in desing of new, similar language
2. It is an inherent part of .NET, which is a big movement towards real distributed SW systems (without the COM Hell). Don't missunderstand me, as an old amigan, I do NOT like M$, but some things I have to admit ;). The MS's millions that went into research must yield somewhere.
3. It has one of the best IDE's
4. It has a giant with money behind


all those arguments could be put towards VB too and no real programmer likes that one and it surely hasn't taken over the program development scene

Microsoft even stated that Windows would be made with VB one day (well that explains a lot actually).

and one reason why C# won't be a big language is ...
MicroSoft, not even their own developers like C# (or Windows for that matter)

 :-D  :-D  :-D
MacOS X rulez!

Quad Mac Rulez!
 

  • Guest
Re: Anti C++ sentiment?
« Reply #32 on: January 28, 2003, 11:13:16 AM »
Quote

Treke wrote:
@DaveP
Quote
No, I think C and C++ are here to stay, Java too. C# will become a nother VB - something that there is a market for and people use but it will not be the be all and end all dominant spirit of the marketplace.

I think oposite, C# has future, because:
1. From the language point of view it is an improved Java, for M$,  years of experience with Java were enough to see, what to improve in desing of new, similar language
2. It is an inherent part of .NET, which is a big movement towards real distributed SW systems (without the COM Hell). Don't missunderstand me, as an old amigan, I do NOT like M$, but some things I have to admit ;). The MS's millions that went into research must yield somewhere.
3. It has one of the best IDE's
4. It has a giant with money behind

Off course Java will not die.

Quote
Perhaps I am wrong, I hope not.

I also hope, that  you are not wrong.

Quote
Hence there will always be a place for procedural C/C++.

Sure.

re

Treke


I agree with you Treke.
Some things could be done better in Java. Espacially what the Virtual Machines concerns. The .NET Framework is very fast. I've tested it. But I think, if Sun continues the Java development and improves their language maybe with dropping a little bit of backwards compatibility and creates an extreme fast Virtual Machine, could again overtake C#.

But don't forget: Java runs on cellular phones (NOT SMARTPHONES WITH WIN CE).  There are also many people hating M$ and who won't program in C# but only in Java. Java is open source. And whe have JSP as a PHP alternative to PHP for great projects. All those people, developing for this systems won't stick to C# or VB.NET or ASP.NET or WHATEVER.NET.
 

Offline Cymric

  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 1031
    • Show only replies by Cymric
Re: Anti C++ sentiment?
« Reply #33 on: January 28, 2003, 10:45:09 PM »
Quote
Karlos wrote:
To all the C coders, there's no non-trivial C program that could in no way benefit from some of C++'s features. Even without classes, there's stuff in there that's damn handy, such as function name overloading, declarations as statements, references to name but a few...

I avoid function name overloading like the plague: the implicit argument type promotion rules to test whether two functions are equal are a nightmare. The feature is useful in a few select cases, but in my experience too often led to obfuscation rather than clarity. References... Now there's a feature I'd love to have in C. Although I also believe that every C(++)-programmer should experience the exquisite emotions caused by an oh-so-subtle pointer bug at least once in their lives.

But despite the better features, it has its share of problems too: the syntax is complex (although not unbearably so), it has no garbage collection and still has you managing memory by yourself, and quite a number of others, which may not directly affect a programmer working on his own, but will when working in a team. See this site, for example, although the author gives off the impression of being holier than thou. You can write solid and tidy code with C++; just keep in mind it is not a miracle cure to every programming problem, OO or otherwise.
Some people say that cats are sneaky, evil and cruel. True, and they have many other fine qualities as well.
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
Re: Anti C++ sentiment?
« Reply #34 on: January 29, 2003, 10:31:24 AM »
Hi Cymric

Quote

Cymric wrote:
...
I avoid function name overloading like the plague: the implicit argument type promotion rules to test whether two functions are equal are a nightmare. The feature is useful in a few select cases, but in my experience too often led to obfuscation rather than clarity.


I agree with you that overloading can be awkward, but if your's sensible with it it can be very useful.
Generally, I only overload function names for custom types rather than the builtin ones, unless I'm damn sure its a good idea.
As you probably know, the classic ambiguities are caused by things like

// plain bad overload example ;-)
// return types not part of overload resoulution

double func(double x, double y);
int func(int x, int y);

int ix = 1, iy = 3;
double dx = 1, dy = 3;
double z;

z = func(ix,  iy); // ok
z = func(dx, dy); // ok
z = func(ix, dy); // Promotion ix to double (?)
z = func(dx, iy); // Promotion iy to double (?)
z = func(1, 3); // Which func() is used?

As you point out, it can get real messy ;-)
To be totally unambiguous, you need to write stuff like

double z = func((double)ix, dy);
double z = func(ix, (int)iy);
double z = func(1.0, 3.0); // uses func(double, double)
double z = func((int)1, (int)3); // uses func(int, int)

Yuk! All of which is not nice for readability.

Now, what I would do is something like this

// in reality, I'd use a class, but for sake of a
// no-classes C-style code example

typedef struct {
  double real;
  double imaginary;
}  complex_t;

// function name overloading and references...
complex_t func(complex_t& x, complex_t& y);
double func(double x, double y);

It would be pretty difficult to muddle up the above two functions.

Quote

References... Now there's a feature I'd love to have in C. Although I also believe that every C(++)-programmer should experience the exquisite emotions caused by an oh-so-subtle pointer bug at least once in their lives.


:-) Agreed. When I first started using C, I had to chase a few obscure pointer bugs. Lovely!

References are real handy and often get used to avoid passing/returning large objects. But you do have to be careful when returning references - a lot of problems are caused by returning references to objects that only exist within the scope of the function in which they were created. Just as bad as any pointer bug :-D

Also, unlike references in Java, once assigned, the reference can't be reassigned - the reference and the object referenced are as one ;-)

Quote

But despite the better features, it has its share of problems too: the syntax is complex (although not unbearably so), it has no garbage collection and still has you managing memory by yourself, and quite a number of others, which may not directly affect a programmer working on his own, but will when working in a team.


Well, C has no garbage collection either. It's a double edged sword anyhow. Garbage collection is not all that it's cracked up to be IM (not so?) HO.

Incidentally, there are plenty of garbage collectors available for C++, it's just not part of the standard library (some implementations do come with them however).
The difficulty in their implemtation comes down to the fact that C++ is not pure OOP and things like pointers make garbage collection tricky.
In java for example, there are no pointers and every class is ultimately derived from 'Object' so it's possible to track every instance of every class and determine when an object has gone out of scope and can be recycled. But the convenience does not come for free either.

In most C++ garbage collectors, you have to write your class around whatever 'collectable' service class the garbage collector implementation provides.

Maybe I'm old school but I prefer manual memory management. Best clean up after yourself, so my mum taught me ;-)

When it comes to large scale, multi-person programming, features like namespaces are ideal.

Quote

You can write solid and tidy code with C++; just keep in mind it is not a miracle cure to every programming problem, OO or otherwise.


Well, I never said it was a miracle cure ;-)

But it is quite useful nontheless.

int p; // A
 

Offline Mr_Capehill

  • Full Member
  • ***
  • Join Date: May 2002
  • Posts: 189
    • Show only replies by Mr_Capehill
Re: Anti C++ sentiment?
« Reply #35 on: February 12, 2003, 03:00:15 PM »
Well, it's "natural" to program Amiga in C. I mean all the examples from DevCD, for example, are pure C code.

In the eyes of a beginner C++ looks scary (as a novice, I know that :). Lots of complex structures etc, namespaces, constructors, pointers, polymorphism etc. It doesn't look very nice and clean, no wonder since it was originally extended from C.

But the point is that C is an old language missing many features, and C++ is very important language these days (with Java). Maybe this could be taken into account with the new developer material?

Anyway, I hope the best luck to you with your book and I will be buying it when published :-D
 

Offline iamaboringperson

  • Hero Member
  • *****
  • Join Date: Jun 2002
  • Posts: 5744
    • Show only replies by iamaboringperson
Re: Anti C++ sentiment?
« Reply #36 on: February 12, 2003, 06:00:05 PM »
@Mr_Capehill
Quote
In the eyes of a beginner C++ looks scary (as a novice, I know that :). Lots of complex structures etc, namespaces, constructors, pointers, polymorphism etc. It doesn't look very nice and clean, no wonder since it was originally extended from C.

pointers are in C too! didnt you know that?
+ structures can be complex in c

it might not look 'nice & clean' to a begginer, but i would say it looks ok to me

being extended from C is one of C++'s best features!

Quote
But the point is that C is an old language missing many features, and C++ is very important language these days (with Java). Maybe this could be taken into account with the new developer material?

its an old language, but what features is it missing?
apart from OOP?

C AND C++ are both very good languages, and very general purpose, these two languages should last for decades and allways stay strong no matter what 'fad' languages there are out there

 

Offline Mr_Capehill

  • Full Member
  • ***
  • Join Date: May 2002
  • Posts: 189
    • Show only replies by Mr_Capehill
Re: Anti C++ sentiment?
« Reply #37 on: February 13, 2003, 09:52:16 AM »
Yes I know that there are pointers in C, and that it can look very complex too. (I'm sure C doesn't fascinate beginners either :)

Well, of course the classes and many other things which might make it more complex but also more powerful and suitable for large scale applications etc.

C won't die as long as the Unices (whats the plural form?) and Linux  stay around.

I didn't actually meant to put C++ down, but just wanted to tell about my feeling when I first time read C++ code. Of course it has become a lot more clear since then  :-D

Any C++ tutorials for Amiga on the net?
 

Offline gregthecanuck

  • Full Member
  • ***
  • Join Date: Feb 2003
  • Posts: 169
  • Country: ca
    • Show only replies by gregthecanuck
Re: Anti C++ sentiment?
« Reply #38 on: February 13, 2003, 10:59:20 AM »
Hi siciliano -

One of the things you learn as a developer is that no one tool does everything.

C++ is very good for certain applications.  So is Java .  So is Powerbuilder.

I wouldn't try writing an accounting system in C++.  Neither would I try writing a device driver in Powerbuilder.

For most of the stuff I do C++ is too low-level.  I have used Powerbuilder for applications such as hotel reservation systems.  It is a good fit for this type of application (database, objects, heavy GUI user I-O, report writing, etc).  This type of support is all built-in.

Sorry to stray off-topic, but why do you think Powerbuilder is so horrible?  


Have a great day, eh?

Greg
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
Re: Anti C++ sentiment?
« Reply #39 on: February 13, 2003, 11:25:45 AM »
What we have all learned here is that everything is good for something...

Except for AMOS....

(a hail of blazing molatov's rain down on karlos...)

Jeez, only joking! Still, better get my flame retardant jacket ;-)

int p; // A
 

Offline Mr_Capehill

  • Full Member
  • ***
  • Join Date: May 2002
  • Posts: 189
    • Show only replies by Mr_Capehill
Re: Anti C++ sentiment?
« Reply #40 on: February 13, 2003, 11:44:46 AM »
I prefer using Amos any day instead of AmigaBasic!!! !! !  :-D
 

  • Guest
Re: Anti C++ sentiment?
« Reply #41 on: February 13, 2003, 11:45:39 AM »
Quote
its an old language, but what features is it missing?

garbage collection.
 

Offline Hammer

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 1996
  • Country: 00
    • Show only replies by Hammer
Re: Anti C++ sentiment?
« Reply #42 on: February 13, 2003, 11:50:00 AM »
I prefer Borland C++ Builder (and I’ll use MS’s VC IF required), Borland builder products should be similar to MS’s C#, since the person who created it has been assimilated within Microsoft (for the dotNET Visual Studio product).  

PS; “Amgia Basic” is just Microsoft Basic renamed…
Amiga 1200 PiStorm32-Emu68-RPI 4B 4GB.
Ryzen 9 7900X, DDR5-6000 64 GB, RTX 4080 16 GB PC.
 

Offline Mr_Capehill

  • Full Member
  • ***
  • Join Date: May 2002
  • Posts: 189
    • Show only replies by Mr_Capehill
Re: Anti C++ sentiment?
« Reply #43 on: February 13, 2003, 12:02:04 PM »
Now, the lack of carbage collection and pointer usage separates languages for real men and others :)

Yes, indeed AmigaBasic was a Microsoft product. Luckily I haven't been using it a lot (it crashed all the time) but I have heard from a zillion of sources that it was a nightmare  :-P
 

  • Guest
Re: Anti C++ sentiment?
« Reply #44 on: February 13, 2003, 12:17:03 PM »
Quote

Mr_Capehill wrote:
Now, the lack of carbage collection and pointer usage separates languages for real men and others :)

[...]

yes, the real men have much time and strong nerves.  :-D