[OT] Visual C++ question
Jerry Feldman
gaf at gaf.blu.org
Fri Feb 14 19:16:35 EST 2003
If I had Visual C++ I would have found an answer :-)
On 14 Feb 2003 15:56:15 -0500
kclark at CetaceanNetworks.com (Kevin D. Clark) wrote:
>
> Jerry Feldman <gaf at gaf.blu.org> writes:
>
> > I teach C programming at Northeastern, and most of my students this
> > quarter are using GCC, but WRT: Visual C++.
> > How does one tell Visual C++ that it should be compiling a straight
> > C program, not C++.
> >
> > Also, the same might go for Borland also.
>
> In my experience, VC++ doesn't automatically go into "C only" mode
> when compiling a file with a certain extension (like ".C"). I looked
> for a flag to force this a long time ago but I don't remember if I
> found anything or not.
>
> However, assuming that VC++ is purporting to be a C compiler, what
> happens when you send the following code through it?:
>
>
> /* author: dan pop */
> #include <stdio.h>
>
> #if defined __STDC_VERSION__ && __STDC_VERSION__ == 199901L
> int c99 = 1;
> #else
> int c99 = 0;
> #endif
>
> int main(void)
> {
> if (1 //* */ 2
> ) {
> if (c99) puts("C99 compiler.");
> else if (sizeof 'a' > 1) puts("Broken C89 compiler.");
> else puts("C++ compiler.");
> }
> else puts("C89 compiler.");
> return 0;
> }
>
>
> You hit the nail on the head when you stated that C is not a subset of
> C++ and C++ is not a superset of C...
>
> Regards,
>
> --kevin
> --
> If you want to program in C, program in C. It's a nice language. I
> use it occasionally... :-)
> --Larry Wall in <7577 at jpl-devvax.JPL.NASA.GOV>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.blu.org/pipermail/discuss/attachments/20030214/e26b2853/attachment.sig>
More information about the Discuss
mailing list