Thread: RE: [Dev-C++] c or c++. that is the question
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Reid T. <Rei...@at...> - 2003-04-23 03:02:55
|
many reasons..., here's the first that comes to my mind....
size:
-rwxrwxrwx 1 Reid.Tho Domain U 19223 Apr 22 22:22 tstC.exe*
-rwxrwxrwx 1 Reid.Tho Domain U 448506 Apr 22 22:29 tstCPP.exe*
stripped:
-rwxrwxrwx 1 Reid.Tho Domain U 10240 Apr 22 22:32 tstC.exe*
-rwxrwxrwx 1 Reid.Tho Domain U 219136 Apr 22 22:32 tstCPP.exe*
=20
and ease of use is subjective :)
=20
#include <stdio.h>
=20
int main(void)
{
printf("hello world");
return 0;
}
---------------------------
#include <iostream>
using namespace std;
=20
int main(void)
{
cout << "hello world";
return 0;
}
=20
or, since everything 'should' be a class/object:
=20
#include <iostream>
using namespace std;
=20
class Hello
{
public:
void print(void)
{
cout << "hello world" << endl;
}
};
int main(void)
{
Hello* p =3D new Hello;
p -> print();
delete p;
return 0;
}
-rwxrwxrwx 1 Reid.Tho Domain U 449115 Apr 22 22:51 tstCPP.exe*
stripped
-rwxrwxrwx 1 Reid.Tho Domain U 219648 Apr 22 22:55 tstCPP.exe*
=20
=20
reid=20
-----Original Message-----
From: jose isaias cabrera [mailto:ji...@fr...]=20
Sent: Tuesday, April 22, 2003 10:17 PM
To: dev...@li...
Subject: [Dev-C++] c or c++. that is the question
=09
=09
=20
Greetings!
=20
Here is a question for all: why would anyone use c when c++ is so much =
easier?
=20
jos=E9
|
|
From: Khalid El-K. <kha...@ho...> - 2003-04-23 04:19:21
|
One question: is there a extern "C++" like there's extern "C" ? if there's isn't, C code will be more useable, for both C++ and C programms. (?) Khalid >Ioannis wearing his bullet-proof vest: > > >Keep in mind that the prevalent X-Window library now is a C++ one. Also >most >new GNU/Linux programs are being written in C++ these days... > > >File sizes for the hello world program should not be different. > > > > >Ioannis Vranos > >* Programming pages: http://www.noicys.freeurl.com >* Alternative URL 1: http://run.to/noicys >* Alternative URL 2: http://www.noicys.cjb.net > > >Anti-racism movement: http://www.positive-youthfoundation.org >Iraq Peace Pledge: http://www.peacepledge.org > > > > > >-----Original Message----- >From: dev...@li... >[mailto:dev...@li...] On Behalf Of Reid >Thompson >Sent: Wednesday, April 23, 2003 6:03 AM >To: dev...@li... >Subject: RE: [Dev-C++] c or c++. that is the question > > >many reasons..., here's the first that comes to my mind.... >size: >-rwxrwxrwx 1 Reid.Tho Domain U 19223 Apr 22 22:22 tstC.exe* >-rwxrwxrwx 1 Reid.Tho Domain U 448506 Apr 22 22:29 tstCPP.exe* >stripped: >-rwxrwxrwx 1 Reid.Tho Domain U 10240 Apr 22 22:32 tstC.exe* >-rwxrwxrwx 1 Reid.Tho Domain U 219136 Apr 22 22:32 tstCPP.exe* > > >and ease of use is subjective :) > >#include <stdio.h> > >int main(void) >{ > printf("hello world"); > return 0; >} >--------------------------- >#include <iostream> >using namespace std; > >int main(void) >{ > cout << "hello world"; > return 0; >} > >or, since everything 'should' be a class/object: > >#include <iostream> >using namespace std; > >class Hello >{ > public: > void print(void) > { > cout << "hello world" << endl; > } >}; >int main(void) >{ > Hello* p = new Hello; > p -> print(); > delete p; > return 0; >} >-rwxrwxrwx 1 Reid.Tho Domain U 449115 Apr 22 22:51 tstCPP.exe* >stripped >-rwxrwxrwx 1 Reid.Tho Domain U 219648 Apr 22 22:55 tstCPP.exe* > > > > > > > > >reid >-----Original Message----- >From: jose isaias cabrera [mailto:ji...@fr...] >Sent: Tuesday, April 22, 2003 10:17 PM >To: dev...@li... >Subject: [Dev-C++] c or c++. that is the question > > > >Greetings! > >Here is a question for all: why would anyone use c when c++ is so much >easier? > >josé > > > > >------------------------------------------------------- >This sf.net email is sponsored by:ThinkGeek >Welcome to geek heaven. >http://thinkgeek.com/sf >_______________________________________________ >Dev-cpp-users mailing list >Dev...@li... >TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users _________________________________________________________________ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail |
|
From: Ioannis V. <iv...@at...> - 2003-04-23 04:53:16
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Khalid El-Kary > Sent: Wednesday, April 23, 2003 7:19 AM > To: Dev...@li... > Subject: RE: [Dev-C++] c or c++. that is the question > > > One question: > > is there a extern "C++" like there's extern "C" ? > > if there's isn't, C code will be more useable, for both C++ > and C programms. > (?) > > > Khalid extern "C" works both ways! If you want to use your C++ code in C programs, enclose the C++ *definitions* inside extern "C" blocks. Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL 1: http://run.to/noicys * Alternative URL 2: http://www.noicys.cjb.net Anti-racism movement: http://www.positive-youthfoundation.org Iraq Peace Pledge: http://www.peacepledge.org |
|
From: Norman G. <no...@ju...> - 2003-04-23 05:58:36
|
On Tue, 22 Apr 2003 22:16:34 -0400 "jose isaias cabrera" <ji...@fr...> writes: >Here is a question for all: why would anyone use c when c++ is so much easier? Two obvious reasons are executable code size and compiler capability. Code written in C usually generates smaller executables than code written in C++. Because of this you are more likely to use C only for embedded applications. If you are using a C only compiler (and there still several around) then the use of C only is a given. Many older C/C++ compilers will have a lot of trouble with modern ANSI C++, but will probably work fine with C code. Also, there are several interpreters and script languages based on C, but very few based on (the more complex) C++. Is C++ really easier to use than C? The answer is a matter of opinion ... many will disagree! Norm |
|
From: Ioannis V. <iv...@at...> - 2003-04-23 06:14:36
|
A C++ program should not be less space/time efficient than an equivalent = C program. Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL 1: http://run.to/noicys * Alternative URL 2: http://www.noicys.cjb.net Anti-racism movement: http://www.positive-youthfoundation.org Iraq Peace Pledge: http://www.peacepledge.org=20 -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Norman Gonsalves Sent: Wednesday, April 23, 2003 8:57 AM To: dev...@li... Subject: Re: [Dev-C++] c or c++. that is the question On Tue, 22 Apr 2003 22:16:34 -0400 "jose isaias cabrera" <ji...@fr...> writes: >Here is a question for all: why would anyone use c when c++ is so much easier? Two obvious reasons are executable code size and compiler capability. Code written in C usually generates smaller executables than code = written in C++. Because of this you are more likely to use C only for embedded applications. If you are using a C only compiler (and there still several around) then = the use of C only is a given. Many older C/C++ compilers will have a lot of trouble with modern ANSI C++, but will probably work fine with C code. = Also, there are several interpreters and script languages based on C, but very = few based on (the more complex) C++. Is C++ really easier to use than C? The answer is a matter of opinion = ... many will disagree! Norm |
|
From: jose i. c. <ji...@fr...> - 2003-04-23 14:21:16
|
Well, perhaps I was prematured in posing the question. I can see your = point. My first project was to parse through up to ten text files of = 2megs each and create a report and it was very complicated using text = handling functions to split a line, to search through a really long line = of text, etc... Then finding out that c++ has string functions, I was = like, "dude, nice!" :') jos=E9 ----- Original Message -----=20 From: Norman Gonsalves=20 To: dev...@li...=20 Sent: Wednesday, April 23, 2003 1:57 AM Subject: Re: [Dev-C++] c or c++. that is the question On Tue, 22 Apr 2003 22:16:34 -0400 "jose isaias cabrera" = <ji...@fr...> writes: >Here is a question for all: why would anyone use c when c++ is so = much easier? Two obvious reasons are executable code size and compiler capability. Code written in C usually generates smaller executables than code = written in C++. Because of this you are more likely to use C only for = embedded applications. If you are using a C only compiler (and there still several around) = then the use of C only is a given. Many older C/C++ compilers will have = a lot of trouble with modern ANSI C++, but will probably work fine with = C code. Also, there are several interpreters and script languages based = on C, but very few based on (the more complex) C++. Is C++ really easier to use than C? The answer is a matter of opinion = ..... many will disagree! Norm |
|
From: Reid T. <Rei...@at...> - 2003-04-23 11:35:24
|
initial file sizes compiled on cygwin gcc/g++.
these compiled on RH 7.2 gcc/g++ - not as large a difference, but a =
difference.
Not sure how that would equate out if the program was 10K lines, or 100K =
lines, etc
gcc version 2.96 20000731 (Red Hat Linux 7.2 2.96-108.7.2)
-rwxr-xr-x 1 rthompso staff 13738 Apr 23 07:29 tst*
-rwxr-xr-x 1 rthompso staff 14765 Apr 23 07:29 tstCpp*
stripped
-rwxr-xr-x 1 rthompso staff 4088 Apr 23 07:31 tstCpp*
-rwxr-xr-x 1 rthompso staff 3272 Apr 23 07:31 tst*
#include <stdio.h>
int main(void)
{
printf("hello world\n");
return 0;
}
#include <iostream>
using namespace std;
class Hello
{
public:
void print(void)
{
cout << "hello world" << endl;
}
};
int main(void)
{
Hello* p =3D new Hello;
p -> print();
delete p;
return 0;
}
reid
> -----Original Message-----
> From: Khalid El-Kary [mailto:kha...@ho...]=20
> Sent: Wednesday, April 23, 2003 12:19 AM
> To: Dev...@li...
> Subject: RE: [Dev-C++] c or c++. that is the question
>=20
>=20
> One question:
>=20
> is there a extern "C++" like there's extern "C" ?
>=20
> if there's isn't, C code will be more useable, for both C++=20
> and C programms.=20
> (?)
>=20
>=20
> Khalid
> >Ioannis wearing his bullet-proof vest:
> >
> >
> >Keep in mind that the prevalent X-Window library now is a=20
> C++ one. Also
> >most
> >new GNU/Linux programs are being written in C++ these days...
> >
> >
> >File sizes for the hello world program should not be different.
> >
> >
> >
> >
> >Ioannis Vranos
> >
> >* Programming pages: http://www.noicys.freeurl.com
> >* Alternative URL 1: http://run.to/noicys
> >* Alternative URL 2: http://www.noicys.cjb.net
> >
> >
> >Anti-racism movement: http://www.positive-youthfoundation.org
> >Iraq Peace Pledge: http://www.peacepledge.org
> >
> >
> >
> >
> >
> >-----Original Message-----
> >From: dev...@li...
> >[mailto:dev...@li...] On Behalf Of Reid=20
> >Thompson
> >Sent: Wednesday, April 23, 2003 6:03 AM
> >To: dev...@li...
> >Subject: RE: [Dev-C++] c or c++. that is the question
> >
> >
> >many reasons..., here's the first that comes to my mind....
> >size:
> >-rwxrwxrwx 1 Reid.Tho Domain U 19223 Apr 22 22:22 tstC.exe*
> >-rwxrwxrwx 1 Reid.Tho Domain U 448506 Apr 22 22:29 tstCPP.exe*
> >stripped:
> >-rwxrwxrwx 1 Reid.Tho Domain U 10240 Apr 22 22:32 tstC.exe*
> >-rwxrwxrwx 1 Reid.Tho Domain U 219136 Apr 22 22:32 tstCPP.exe*
> >
> >
> >and ease of use is subjective :)
> >
> >#include <stdio.h>
> >
> >int main(void)
> >{
> > printf("hello world");
> > return 0;
> >}
> >---------------------------
> >#include <iostream>
> >using namespace std;
> >
> >int main(void)
> >{
> > cout << "hello world";
> > return 0;
> >}
> >
> >or, since everything 'should' be a class/object:
> >
> >#include <iostream>
> >using namespace std;
> >
> >class Hello
> >{
> > public:
> > void print(void)
> > {
> > cout << "hello world" << endl;
> > }
> >};
> >int main(void)
> >{
> > Hello* p =3D new Hello;
> > p -> print();
> > delete p;
> > return 0;
> >}
> >-rwxrwxrwx 1 Reid.Tho Domain U 449115 Apr 22 22:51 tstCPP.exe*
> >stripped
> >-rwxrwxrwx 1 Reid.Tho Domain U 219648 Apr 22 22:55 tstCPP.exe*
> >
> >
> >
> >
> >
> >
> >
> >
> >reid
> >-----Original Message-----
> >From: jose isaias cabrera [mailto:ji...@fr...]
> >Sent: Tuesday, April 22, 2003 10:17 PM
> >To: dev...@li...
> >Subject: [Dev-C++] c or c++. that is the question
> >
> >
> >
> >Greetings!
> >
> >Here is a question for all: why would anyone use c when c++=20
> is so much=20
> >easier?
> >
> >jos=E9
> >
> >
> >
> >
> >-------------------------------------------------------
> >This sf.net email is sponsored by:ThinkGeek
> >Welcome to geek heaven.
> >http://thinkgeek.com/sf=20
> _______________________________________________
> >Dev-cpp-users mailing list
> >Dev...@li...
> >TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>=20
>=20
> _________________________________________________________________
> Add photos to your e-mail with MSN 8. Get 2 months FREE*.=20
> http://join.msn.com/?page=3Dfeatures/featuredemail
>=20
>=20
>=20
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>=20
|
|
From: Ioannis V. <iv...@at...> - 2003-04-23 12:32:49
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Reid Thompson > Sent: Wednesday, April 23, 2003 2:35 PM > To: Khalid El-Kary; Dev...@li... > Subject: RE: [Dev-C++] c or c++. that is the question > > > initial file sizes compiled on cygwin gcc/g++. > these compiled on RH 7.2 gcc/g++ - not as large a difference, > but a difference. > Not sure how that would equate out if the program was 10K > lines, or 100K lines, etc > gcc version 2.96 20000731 (Red Hat Linux 7.2 2.96-108.7.2) This doesn't mean anything other than that the C++ part of the compiler has more space of improvement (after all C++ standard is relatively new!). References: http://www.research.att.com/~bs/bs_faq.html#Hello-world http://www.research.att.com/~bs/esc99.html and my own benchmarks: http://www23.brinkster.com/noicys/cppfaq.htm Check them out. Regards, Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL 1: http://run.to/noicys * Alternative URL 2: http://www.noicys.cjb.net Anti-racism movement: http://www.positive-youthfoundation.org Iraq Peace Pledge: http://www.peacepledge.org |
|
From: Louis G. <lg...@ya...> - 2003-04-23 15:39:40
|
Reid,
Does "stripped" mean no debug info ?
--- Reid Thompson <Rei...@at...> wrote:
> initial file sizes compiled on cygwin gcc/g++.
> these compiled on RH 7.2 gcc/g++ - not as large a difference, but a
> difference.
> Not sure how that would equate out if the program was 10K lines, or 100K
> lines, etc
> gcc version 2.96 20000731 (Red Hat Linux 7.2 2.96-108.7.2)
>
> -rwxr-xr-x 1 rthompso staff 13738 Apr 23 07:29 tst*
> -rwxr-xr-x 1 rthompso staff 14765 Apr 23 07:29 tstCpp*
> stripped
> -rwxr-xr-x 1 rthompso staff 4088 Apr 23 07:31 tstCpp*
> -rwxr-xr-x 1 rthompso staff 3272 Apr 23 07:31 tst*
>
> #include <stdio.h>
>
> int main(void)
> {
> printf("hello world\n");
> return 0;
> }
>
>
> #include <iostream>
> using namespace std;
>
> class Hello
> {
> public:
> void print(void)
> {
> cout << "hello world" << endl;
> }
> };
> int main(void)
> {
> Hello* p = new Hello;
> p -> print();
> delete p;
> return 0;
> }
>
> reid
>
>
> > -----Original Message-----
> > From: Khalid El-Kary [mailto:kha...@ho...]
> > Sent: Wednesday, April 23, 2003 12:19 AM
> > To: Dev...@li...
> > Subject: RE: [Dev-C++] c or c++. that is the question
> >
> >
> > One question:
> >
> > is there a extern "C++" like there's extern "C" ?
> >
> > if there's isn't, C code will be more useable, for both C++
> > and C programms.
> > (?)
> >
> >
> > Khalid
> > >Ioannis wearing his bullet-proof vest:
> > >
> > >
> > >Keep in mind that the prevalent X-Window library now is a
> > C++ one. Also
> > >most
> > >new GNU/Linux programs are being written in C++ these days...
> > >
> > >
> > >File sizes for the hello world program should not be different.
> > >
> > >
> > >
> > >
> > >Ioannis Vranos
> > >
> > >* Programming pages: http://www.noicys.freeurl.com
> > >* Alternative URL 1: http://run.to/noicys
> > >* Alternative URL 2: http://www.noicys.cjb.net
> > >
> > >
> > >Anti-racism movement: http://www.positive-youthfoundation.org
> > >Iraq Peace Pledge: http://www.peacepledge.org
> > >
> > >
> > >
> > >
> > >
> > >-----Original Message-----
> > >From: dev...@li...
> > >[mailto:dev...@li...] On Behalf Of Reid
> > >Thompson
> > >Sent: Wednesday, April 23, 2003 6:03 AM
> > >To: dev...@li...
> > >Subject: RE: [Dev-C++] c or c++. that is the question
> > >
> > >
> > >many reasons..., here's the first that comes to my mind....
> > >size:
> > >-rwxrwxrwx 1 Reid.Tho Domain U 19223 Apr 22 22:22 tstC.exe*
> > >-rwxrwxrwx 1 Reid.Tho Domain U 448506 Apr 22 22:29 tstCPP.exe*
> > >stripped:
> > >-rwxrwxrwx 1 Reid.Tho Domain U 10240 Apr 22 22:32 tstC.exe*
> > >-rwxrwxrwx 1 Reid.Tho Domain U 219136 Apr 22 22:32 tstCPP.exe*
> > >
> > >
> > >and ease of use is subjective :)
> > >
> > >#include <stdio.h>
> > >
> > >int main(void)
> > >{
> > > printf("hello world");
> > > return 0;
> > >}
> > >---------------------------
> > >#include <iostream>
> > >using namespace std;
> > >
> > >int main(void)
> > >{
> > > cout << "hello world";
> > > return 0;
> > >}
> > >
> > >or, since everything 'should' be a class/object:
> > >
> > >#include <iostream>
> > >using namespace std;
> > >
> > >class Hello
> > >{
> > > public:
> > > void print(void)
> > > {
> > > cout << "hello world" << endl;
> > > }
> > >};
> > >int main(void)
> > >{
> > > Hello* p = new Hello;
> > > p -> print();
> > > delete p;
> > > return 0;
> > >}
> > >-rwxrwxrwx 1 Reid.Tho Domain U 449115 Apr 22 22:51 tstCPP.exe*
> > >stripped
> > >-rwxrwxrwx 1 Reid.Tho Domain U 219648 Apr 22 22:55 tstCPP.exe*
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >reid
> > >-----Original Message-----
> > >From: jose isaias cabrera [mailto:ji...@fr...]
> > >Sent: Tuesday, April 22, 2003 10:17 PM
> > >To: dev...@li...
> > >Subject: [Dev-C++] c or c++. that is the question
> > >
> > >
> > >
> > >Greetings!
> > >
> > >Here is a question for all: why would anyone use c when c++
> > is so much
> > >easier?
> > >
> > >josé
> > >
> > >
> > >
> > >
> > >-------------------------------------------------------
> > >This sf.net email is sponsored by:ThinkGeek
> > >Welcome to geek heaven.
> > >http://thinkgeek.com/sf
> > _______________________________________________
> > >Dev-cpp-users mailing list
> > >Dev...@li...
> > >TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> > >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> >
> >
> > _________________________________________________________________
> > Add photos to your e-mail with MSN 8. Get 2 months FREE*.
> > http://join.msn.com/?page=features/featuredemail
> >
> >
> >
> > -------------------------------------------------------
> > This sf.net email is sponsored by:ThinkGeek
> > Welcome to geek heaven.
> > http://thinkgeek.com/sf
> > _______________________________________________
> > Dev-cpp-users mailing list
> > Dev...@li...
>
=== message truncated ===
__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com
|
|
From: Krzysztof K. <sa...@op...> - 2003-04-24 13:10:32
|
> Khalid > >Ioannis wearing his bullet-proof vest: > > > > > >Keep in mind that the prevalent X-Window library now is a > C++ one. Also > >most > >new GNU/Linux programs are being written in C++ these days... > > > > > >File sizes for the hello world program should not be different. > > This is not exactly right. One of the reasons why the C++ code could be larger/slower than C one (not much, just a bit) is that for every object the '*this' pointer is added to function params. Just putting it one the stack takes a bit of time and a bit of space... Why people need to use C sometimes instead of C++? Because there are many platforms (especially microcontrollers) for which there is a C compiler but no C++ is available. Also the object-oriented (C++) programming (with analysis, optimization) is more complicated than programming without objects. -- Have a nice life, Krzysztof mailto:sa...@op... http://www.saveman.w.pl |
|
From: Ioannis V. <iv...@at...> - 2003-04-24 18:49:06
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Krzysztof Kapuscik > Sent: Thursday, April 24, 2003 4:10 PM > To: Dev...@li... > Subject: Fwd: RE: [Dev-C++] c or c++. that is the question > > > This is not exactly right. One of the reasons why the C++ code could > be larger/slower than C one (not much, just a bit) is that for every > object the '*this' pointer is added to function params. Just putting > it one the stack takes a bit of time and a bit of space... > > Why people need to use C sometimes instead of C++? Because there are > many platforms (especially microcontrollers) for which there is a > C compiler but no C++ is available. Also the object-oriented (C++) > programming (with analysis, optimization) is more complicated than > programming without objects. If a "this" pointer is considered too costly to you then don't use objects in your C++ code. Do you believe that C is better than the procedural paradigm of C++ (the C-subset?). Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL 1: http://run.to/noicys * Alternative URL 2: http://www.noicys.cjb.net Anti-racism movement: http://www.positive-youthfoundation.org Iraq Peace Pledge: http://www.peacepledge.org |
|
From: Khalid El-K. <kha...@ho...> - 2003-04-23 14:26:23
|
Hi fellows, In my point of view, I believe that C is simpler, lower-level. simplicity always has some merits, like the mentioned file size issue. C++ on the other hand is better structered, geared towards better integration in work and gains higher code-reusability...and the other advantages of OO languages :-) I don't believe in the way of saying "lang_name is the best" (where lang_name is your prefered language)--every language suites a purpose, and every purpose has a best language for it. I believe, C is very good for work where performance makes much difference, performance also means memory usage which is affected by the executable file size. one of the good proofs that C applications are geared towards performance is, the writing of the Apache HTTP server, PHP, Python, MySQL in C, note that all these applications are designed for plain performance, for the high web traffic. C++, is better in companies work, where you don't have hackers and volunteers, where you have dead lines :-) because it makes the development and maintenance proccess easier. and modularized ... personally I always prefer C, since I like the old-style simple things, and since I didn't find a bad behaviour or a draw back in its coding style, I won't change until I'm obliged by a boss ... HTH Regards, Khalid Al-Kary _________________________________________________________________ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail |
|
From: Ioannis V. <iv...@at...> - 2003-04-23 16:19:50
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Khalid El-Kary > Sent: Wednesday, April 23, 2003 5:26 PM > To: Dev...@li... > Subject: RE: [Dev-C++] c or c++. that is the question > > > Hi fellows, > In my point of view, I believe that C is simpler, lower-level. > simplicity always has some merits, like the mentioned file size issue. > > C++ on the other hand is better structered, geared towards better > integration in work and gains higher code-reusability...and the other > advantages of OO languages :-) C++ is not just OO. Supports 4 paradigms including the C's one (and that with better type checking). > > I don't believe in the way of saying "lang_name is the best" (where > lang_name is your prefered language)--every language suites a > purpose, and > every purpose has a best language for it. > > I believe, C is very good for work where performance makes > much difference, > performance also means memory usage which is affected by the > executable file > size. one of the good proofs that C applications are geared towards > performance is, the writing of the Apache HTTP server, PHP, > Python, MySQL in > C, note that all these applications are designed for plain > performance, for > the high web traffic. Check my own benchmarks: http://www23.brinkster.com/noicys/cppfaq.htm > C++, is better in companies work, where you don't have hackers and > volunteers, where you have dead lines :-) because it makes > the development > and maintenance proccess easier. and modularized ... C++ is excellent for hacking. It leaves no room for a lower level language except assembly. At the same time provides great abstraction with higher level facilities. > > personally I always prefer C, since I like the old-style > simple things, and > since I didn't find a bad behaviour or a draw back in its > coding style, I > won't change until I'm obliged by a boss ... It's a religious issue but I consider C++ better since string s; cin>>s; is simpler and safer than char *. C is OK but especially after C99 I consider it dead (Ioannis takes cover). Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL 1: http://run.to/noicys * Alternative URL 2: http://www.noicys.cjb.net Anti-racism movement: http://www.positive-youthfoundation.org Iraq Peace Pledge: http://www.peacepledge.org |
|
From: jp <rar...@xt...> - 2003-04-24 02:25:30
|
C is an assembler macro language C++ is C with classes (inheritance, protected members and a vtable), = templates (structured preprocessing), exceptions and stricter type = checking. C++ features generally map to underlying concepts available = in C, such as exceptions mapping to setjmp/longjmp plus some = book-keeping of the stack. Early C++ actually compiled to C (CFront). C++ is not a first class OO language, and as such can't claim the = benefits of, say LISP or Python. I won't mention the J word, because it = is afflicted with brittle base class syndrome, and intrusive library = syndrome... And I won't mention VB either... Being so close to assembler, C is (comparatively) easy to retarget, and = it is (comparatively) easy for a programmer to understand the impact his = code is having 'on the metal'. Thus C, but probably not C++, can be used = to program the uC in your washing machine. C and C++ are systems programming languages, and it seems to me they are = overkill for 99% of the tasks they are applied to. I direct the person = who doubts this to the Mozilla project, which uses XML for much of the = detail, and to the Python VTK bindings, which make scientific = visualization an efficient and interactive pastime. This said, I use C++ most of the time. I often wrap C libraries and = other APIs with classes, and I like the way C/C++ enables integration of = third party code and binaries without the overburden of something like = ActiveX or custom bindings. I write a lot of tools and subsystems, and I = think C and C++ are good for this. Also, I'm blundering thru a machine = vision project at the moment, and although there are various tools that = do some of what I need (Lush, VXL), I'm preferring to go minimalist, and = use C/C++, including source for functions as I need them. One of my favourite languages is PostScript. I doubt there are many = implementations of it that aren't written in C/C++.=20 Like any trade, half the battle is knowing the tool for the job... |
|
From: Daniel G. <sp...@ho...> - 2003-04-24 09:02:21
|
what about #ifdef __cplusplus //...code #endif or is that something that our company has created themselves? >From: "Ioannis Vranos" <iv...@at...> >To: <Dev...@li...> >Subject: RE: [Dev-C++] c or c++. that is the question >Date: Wed, 23 Apr 2003 07:53:06 +0300 > > > -----Original Message----- > > From: dev...@li... > > [mailto:dev...@li...] On Behalf > > Of Khalid El-Kary > > Sent: Wednesday, April 23, 2003 7:19 AM > > To: Dev...@li... > > Subject: RE: [Dev-C++] c or c++. that is the question > > > > > > One question: > > > > is there a extern "C++" like there's extern "C" ? > > > > if there's isn't, C code will be more useable, for both C++ > > and C programms. > > (?) > > > > > > Khalid > > >extern "C" works both ways! > > >If you want to use your C++ code in C programs, enclose the C++ >*definitions* inside extern "C" blocks. > > > > >Ioannis Vranos > >* Programming pages: http://www.noicys.freeurl.com >* Alternative URL 1: http://run.to/noicys >* Alternative URL 2: http://www.noicys.cjb.net > > >Anti-racism movement: http://www.positive-youthfoundation.org >Iraq Peace Pledge: http://www.peacepledge.org > > > > >------------------------------------------------------- >This sf.net email is sponsored by:ThinkGeek >Welcome to geek heaven. >http://thinkgeek.com/sf >_______________________________________________ >Dev-cpp-users mailing list >Dev...@li... >TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users _________________________________________________________________ Express yourself with cool emoticons http://www.msn.co.uk/messenger |
|
From: Ioannis V. <iv...@at...> - 2003-04-24 18:46:13
|
> -----Original Message----- > From: Daniel Glenfield [mailto:sp...@ho...] > Sent: Thursday, April 24, 2003 12:02 PM > To: iv...@at...; Dev...@li... > Subject: RE: [Dev-C++] c or c++. that is the question > > > what about > #ifdef __cplusplus > //...code > #endif > > or is that something that our company has created themselves? It is an extension of the implementation. extern "C" when applied to a C++ definition creates an object file with C linkage. Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL 1: http://run.to/noicys * Alternative URL 2: http://www.noicys.cjb.net Anti-racism movement: http://www.positive-youthfoundation.org Iraq Peace Pledge: http://www.peacepledge.org |
|
From: Ioannis V. <iv...@at...> - 2003-04-23 03:59:18
|
Ioannis wearing his bullet-proof vest: Keep in mind that the prevalent X-Window library now is a C++ one. Also = most new GNU/Linux programs are being written in C++ these days... File sizes for the hello world program should not be different. Ioannis Vranos =20 * Programming pages: http://www.noicys.freeurl.com * Alternative URL 1: http://run.to/noicys * Alternative URL 2: http://www.noicys.cjb.net Anti-racism movement: http://www.positive-youthfoundation.org Iraq Peace Pledge: http://www.peacepledge.org -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Reid Thompson Sent: Wednesday, April 23, 2003 6:03 AM To: dev...@li... Subject: RE: [Dev-C++] c or c++. that is the question many reasons..., here's the first that comes to my mind.... size: -rwxrwxrwx 1 Reid.Tho Domain U 19223 Apr 22 22:22 tstC.exe* -rwxrwxrwx 1 Reid.Tho Domain U 448506 Apr 22 22:29 tstCPP.exe* stripped: -rwxrwxrwx 1 Reid.Tho Domain U 10240 Apr 22 22:32 tstC.exe* -rwxrwxrwx 1 Reid.Tho Domain U 219136 Apr 22 22:32 tstCPP.exe* =20 and ease of use is subjective :) #include <stdio.h> int main(void) { printf("hello world"); return 0; } --------------------------- #include <iostream> using namespace std; int main(void) { cout << "hello world"; return 0; } or, since everything 'should' be a class/object: #include <iostream> using namespace std; class Hello { public: void print(void) { cout << "hello world" << endl; } }; int main(void) { Hello* p =3D new Hello; p -> print(); delete p; return 0; } -rwxrwxrwx 1 Reid.Tho Domain U 449115 Apr 22 22:51 tstCPP.exe* stripped -rwxrwxrwx 1 Reid.Tho Domain U 219648 Apr 22 22:55 tstCPP.exe* reid=20 -----Original Message----- From: jose isaias cabrera [mailto:ji...@fr...]=20 Sent: Tuesday, April 22, 2003 10:17 PM To: dev...@li... Subject: [Dev-C++] c or c++. that is the question Greetings! Here is a question for all: why would anyone use c when c++ is so much easier? jos=E9 |