On Sat, Jun 21, 2008 at 7:02 PM, Brett McCoy <[EMAIL PROTECTED]> wrote:
> On Sat, Jun 21, 2008 at 1:49 PM, kritika292 <[EMAIL PROTECTED]> wrote:
>
>> is there any program that can run in c but not in c++?

Do you mean 'compile' or 'execute without logical errors?'

>
> Sure... try creating a variable called 'new' in C++... legal in C, but not C++

(compile time) ...or any other keywords that C++ introduced (delete,
class,  bool (depending on compliance of the compiler - C99 does have
bool,) etc.)

(runtime) Anything that relies on "sizeof('a')" being a certain value.

(compile time) Using malloc() without a cast (or any other implicit
cast from void*)

(compile time) Using goto to cross an initialisation.

-- 
PJH

'Two Dead in Baghdad' not 'product-friendly' - Kent Ertugrul, chief
executive of Phorm.

http://shabbleland.myminicity.com/ind

Reply via email to