Re: Simplicity has a future
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Wed, 31 May 2006 05:52:28 GMT
"Tomás" <No.Email@Address> writes:
Keith Thompson posted:
"Tomás" <No.Email@Address> writes:
[...]
I can copy-paste your C code and compile it as C++. If my version is
any slower or uses less memory, I'll eat my hat.
int main(void)
{
int new;
return 0;
}
Smart. If pedantry is what you're after, then:
If I copy-paste your C code, and then go through it for:
(a) Use of C++ keywords
(b) Inconsistencies between C and C++
And then compile it, I guarantee that the C++ version won't be slower or
require more memory.
I agree that it's very likely, but I don't see how you can guarantee
it without a lot more caveats.
If I run the program on a faster computer than you do, mine will
probably be faster than yours. If I use a better compiler than you
do, mine will likely be faster than yours. Many compiler suites that
include C and C++ compilers use different frontends for the two
languages; the C frontend might happen to generate better code than
the C++ frontend.
All else being equal, there's no reason I know of to assume that a
program written in the common subset of C and C++ will be more
efficient when compiled as C than when compiled as C++ (or vice
versa). I'm not confident enough of that to offer to consume any
headgear.
--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.
- References:
- Simplicity has a future
- From: jacob navia
- Re: Simplicity has a future
- From: Tomás
- Re: Simplicity has a future
- From: jacob navia
- Re: Simplicity has a future
- From: Tomás
- Re: Simplicity has a future
- From: Keith Thompson
- Re: Simplicity has a future
- From: Tomás
- Simplicity has a future
- Prev by Date: Re: Bit fiddling
- Next by Date: Re: Bit fiddling
- Previous by thread: Re: Simplicity has a future
- Next by thread: Re: Simplicity has a future
- Index(es):
Relevant Pages
|