Standard C Programming in visual studio

R

Richard Tobin

Richard Heathfield said:
/Za "disables Microsoft extensions".

/W4 raises the diagnostic message level to the highest that Visual C
currently supports (AFAIK).
Those two alone, by the way, should be sufficient to give a level of
conformance that will warm the hearts of all but the very most
pernickety of clc regulars.

So, what do you use?

-- Richard
 
R

robertwessel2

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Richard Heathfield <[email protected]>




  And how to set all those options through the GUI?
The title for those options it's the same that the one I
get on the GUI?


While OT, in VS, under Project, (projectname) Properties, for the
configuration you're using, you'll find Configuration Properties, and
under that the C/C++ properties pages. The options are named, but the
effective command line switches selected are displayed as well.

If you want to do this a lot, you can create a project template with
the options and whatnot you want, so that'll always be set when you
start a new project (Google for it), MS, unfortunately, does not
include a straight "C" project template (although it's not that hard
to create your own).
 
C

CBFalconer

MasterMind said:
How can I set the compiler to be a standard c compiler?

That depends on the actual compiler, and possibly even the system
under which it is running.

Others have given you answers for the Microsoft compiler. More of
the world uses gcc, and for that you can start with:

gcc -W -Wall -ansi -pedantic (and the rest of the cmd line)

For gcc, it is often useful to extend the errors shown. These may
generate unnecessary errors if compiling 'old code', however for
'new code' it would be wise to closely examine anything 'warned'.
So I use:

gcc -W -Wall -ansi -pedantic write-strings -Wfloat-equal -gstabs+
-ftrapv

which is one line, followed by whatever you want. I pack that away
in an alias, called by 'cc'.
 
K

Keith Thompson

CBFalconer said:
That depends on the actual compiler, and possibly even the system
under which it is running.
[...]

Note that the Subject header refers to visual studio. (Yes, that
information should have been in the body of the message.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top