f



program that compiles in C compiler but not in C++ compiler

Hi,

I need a small program that compiles in C compiler but not in C++
compiler.

Thx in advans,
Karthik Balaguru

0
10/11/2006 3:59:42 PM
comp.programming 11491 articles. 2 followers. Post Follow

8 Replies
2322 Views

Similar Articles

[PageSpeed] 21

KBG <karthik.balaguru@lntinfotech.com> wrote:
> I need a small program that compiles in C compiler but not in C++
> compiler.

No problem, just send $10 to paypal@zevv.nl and I'll do your homework
for you.


-- 
:wq
^X^Cy^K^X^C^C^C^C
0
usenet3433 (123)
10/11/2006 4:03:28 PM
KBG said:

> Hi,
> 
> I need a small program that compiles in C compiler but not in C++
> compiler.

Can you think of any syntactic differences between C and C++? For example, 
what about keywords? They are very, very sensitive to syntax. Worth 
thinking about.

-- 
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
0
invalid171 (7008)
10/11/2006 4:09:33 PM
KBG wrote:

> I need a small program that compiles in C compiler but not in C++
> compiler.

Have a look at:

   http://david.tribble.com/text/cdiffs.htm

-- 
mail1dotstofanetdotdk
0
breese (255)
10/11/2006 4:16:36 PM
KBG wrote:
> Hi,
>
> I need a small program that compiles in C compiler but not in C++
> compiler.
>

For sufficiently recent definitions of "C compiler, the following does
the trick, but if this is a homework question it's probably not the
answer you want.

#include <stdio.h>

int main(void)
{
    char * restrict hi = "Hello, world\n";
    printf("%s", hi);
    return 0;
}

0
sjdevnull (405)
10/11/2006 9:15:50 PM
Hi,

Loooks interesting. Need to give these and the links a try this weekend
:):) 

Thx,
Karthik Balaguru

0
10/13/2006 8:37:12 AM

-- 
www.personal.leeds.ac.uk/~bgy1mm
freeware games to download.

"KBG" <karthik.balaguru@lntinfotech.com> wrote in message 
news:1160582382.676563.143370@b28g2000cwb.googlegroups.com...
> Hi,
>
> I need a small program that compiles in C compiler but not in C++
> compiler.
>
> Thx in advans,
> Karthik Balaguru
>
The way to to this is to put a
#ifdef __cplusplus
#error this program must be compiled under C
#endif

in your code.
That way it is obvious that the program is non-cplusplusable, deliberately. 


0
regniztar (3128)
10/14/2006 7:49:19 AM
"Malcolm" <regniztar@btinternet.com> writes:

>>
>> I need a small program that compiles in C compiler but not in C++
>> compiler.
int main(void) {
  int this = 10;
  return 0;
}

very easy. 

-- 
Please remove just-for-news- to reply via e-mail.
0
10/14/2006 8:13:34 AM
KBG wrote:
> 
> Loooks interesting. Need to give these and the links a try this
> weekend :):)

What looks interesting?  Usenet articles need to stand by
themselves, that is what quotes are for.  Google is not Usenet, it
is only an execrebly poor interface to the system.  See my sig and
the links in it below.

-- 
"If you want to post a followup via groups.google.com, don't use
 the broken "Reply" link at the bottom of the article.  Click on 
 "show options" at the top of the article, then click on the 
 "Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>


0
cbfalconer (19194)
10/14/2006 11:39:07 PM
Reply:

Web resources about - program that compiles in C compiler but not in C++ compiler - comp.programming

Compile (publisher) - Wikipedia, the free encyclopedia
Compile was a Japanese videogame developer, most notable for having developed the Puyo Puyo series, based on their Madou Monogatari franchise, ...

Information Is Power: Facebook Develops ThreatData To Compile Data On Web Threats
Part of being able to combat malware, phishing, and other online threats is gathering and consolidating as much data on those threats as possible, ...

Credit Suisse compiles yuan winners and losers list: report
CSL, Macquarie and JB Hi-Fi in the winners column; Crown, Treasury amongst the lowers.

Beijing residents compile own death toll in flooding
Beijing residents fed up with a lack of official updates are compiling their own death tolls for last weekend's deadly floods in the capital, ...

New report compiles 25 years of UFO sightings in Canada
A Winnipeg group called Ufology Research has compiled and analyzed reported sightings of UFOs across Canada over the last 25 years.

China's nat'l library to compile book on Diaoyu Islands
China's nat'l library to compile book on Diaoyu Islands People's Daily Online ... States, Australia and the United Kingdom. The book is aimed ...

Googlers compile holiday search tips in rap video to help Santa with flight
Google is in full holiday swing (what, you haven't heard?). They just posted, on YouTube, a rap video that was put together by its employees, ...

Popular Dating Site Compiles 15 Stupid Reasons To Date A Lawyer
A new listicle describes a really horrible person to date and then says, “we think lawyers are probably this awful, go date them!” Continue ...

Author Compiles Lively L.A. Times History Lesson
Long before Eli Broad , Rupert Murdoch and people willing to pay $140 million for the Las Vegas Review-Journal, there was Harrison Gray Otis ...

Japan, China compile written pledge to improve ties ahead of summit
Japan and China reached a rare written agreement on Nov. 7 to improve relations strained by a territorial dispute over the Senkaku Islands in ...

Resources last updated: 3/15/2016 9:42:33 PM