Re: Cracking DES with C++ is faster than Java?

From: Phil Carmody (thefatphil_demunged_at_yahoo.co.uk)
Date: 04/28/04


Date: 28 Apr 2004 11:05:54 +0300

Julie <julie@nospam.com> writes:

> "Douglas A. Gwyn" wrote:
> >
> > Julie wrote:
> > > What is being talked about is if you take a C source file and create an
> > > executable, then take that same source file and compile it as C++, you will end
> > > up w/ (virtually) identical executables.
> >
> > (Since the languages do not have a subset/
> > superset relationship,
>
> ??? How have you determined that? Do you have any substantive references?

How about the standards? Doug is more well aware of the standard than most.
How about the section in Stroustrup that covers things that used to be legal
in C that aren't legal in C++?

> not, name something that exists in C but not C++ (excluding new C features
> introduced since the last C++ standard).

There are hundreds of examples.

Dumb examples, which you should have been able to work out yourself, would
be major changes to language structure such as:

- Use of C++-only keywords as variable names is legal in C,
  int class;

- Change in comment syntax, the ability in trad C to have a /*comment*/
  immmediately after a division symbol.
  i = x//**/y
      ;

> > in general compiling a
> > C source program with a C++ compiler is not safe.)

However, I'd disagree with Doug's "in general" - unless he means
"given arbitrary source by other people". I frequently migrate
my own old C code to C++ with no changes at all. I don't remember
the last time I encountered _any_ of the many issues.
In general, for me, it is perfectly safe to compile as C++ the code
that I have previously been compiling as C. I know others who
migrate code safely too. In fact in general, people I know migrate
code safely.

Phil

-- 
1st bug in MS win2k source code found after 20 minutes: scanline.cpp
2nd and 3rd bug found after 10 more minutes: gethost.c
Both non-exploitable. (The 2nd/3rd ones might be, depending on the CRTL)


Relevant Pages

  • Re: Cracking DES with C++ is faster than Java?
    ... How about the standards? ... In general, for me, it is perfectly safe to compile as C++ the code ... 1st bug in MS win2k source code found after 20 minutes: ...
    (comp.lang.cpp)
  • Re: Cracking DES with C++ is faster than Java?
    ... How about the standards? ... In general, for me, it is perfectly safe to compile as C++ the code ... 1st bug in MS win2k source code found after 20 minutes: ...
    (sci.crypt)
  • Re: Template open/save behavior
    ... This page does not contain a definition of the term "bug". ... ISO standards or Carnegie Mellon University publications "bug" is defined as ... those standards is an official glossary of industry terms and definitions. ... of flaw (or defect) which was not intended by the designer of the software. ...
    (microsoft.public.mac.office.word)
  • Re: Why did C99 retain getc as a macro?
    ... Standards generally ... that is often considered an optimisation - viz tail recursion ... them will fail to compile on pre-C99 implementations. ...
    (comp.std.c)
  • Re: Roads must roll was Re: Most Ridiculous SF Predictions
    ... Try telling the building inspector that. ... sometimes it actually has to bow to standards documents. ... And even when it *doesn't* bow, and the bug remains, it's still ... that it itself produces means it's wrong, no matter how popular. ...
    (rec.arts.sf.written)