| www.delorie.com/archives/browse.cgi | search |
| From: | dontmailme AT iname DOT com (Steamer) |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: Help! |
| Date: | Sat, 21 Oct 2000 19:44:28 GMT |
| Organization: | always disorganized |
| Lines: | 26 |
| Message-ID: | <39f1f1fd.44260315@news.freeserve.net> |
| References: | <002001c03ac9$ebe70fc0$0500a8c0 AT brk> <39f0b88a DOT 48929103 AT news DOT freeserve DOT net> <834s27rxf2 DOT fsf AT mercury DOT st DOT hmc DOT edu> |
| NNTP-Posting-Host: | modem-59.blue-star-damsel.dialup.pol.co.uk |
| X-Trace: | newsg1.svr.pol.co.uk 972157468 24489 62.136.240.59 (21 Oct 2000 19:44:28 GMT) |
| NNTP-Posting-Date: | 21 Oct 2000 19:44:28 GMT |
| X-Complaints-To: | abuse AT theplanet DOT net |
| X-Newsreader: | Forte Free Agent 1.11/32.235 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
Nate Eldredge wrote:
> Even more fun is the classic scheme
>
> int is_cplusplus(void)
> {
> int x;
> x = 2-2//**/1;
> +1;
> return x;
> }
But this assumes that // comments are not recognized in C, whereas
the new C standard says they should be.
My example was independent of which version of C is used. But it
was a bit long-winded, so here's a slightly simpler version:
#include <stdio.h>
typedef int foo;
int main()
{
struct foo { int x,y; };
printf("C%s\n", sizeof(foo)==sizeof(int) ? "" : "++");
return 0;
}
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |