locked
Checking: How ANSI-C++ compliant is this Express VC RRS feed

  • Question

  • Hi
    I need to do (practise) some ANSI-C++ programming. I suppose these new versions of Visual Studio nets are ANSI-C++ compliant, but are they? I dont want learn after hard work that my work is not according to the standard.

    Second question:
    Is it console settings which are standard. I think there is no dos-mode anymore. Character-based anyway.

    Regards
    L
    Saturday, January 28, 2006 1:04 PM

Answers

  • The VC team tries to be more conformant to the standard from one version of VC to another. For practicing, VC2005 should be applicable.

    Yes, console settings is the way to go.

    Thanks,
    Ayman Shoukry
    VC++ Team
    Saturday, January 28, 2006 3:22 PM
  • Ah well, I must have Standard C on my mind at the moment.  I answered the wrong question.  You want to write standard C++, and you have more options. 

    1. With regard to ISO Standard C++, the extensions to use on files are *.h (or no extension on headers) and *.cpp. 

    There is a complete set of standard C++ libraries provided with the Visual C++ 2005 Express Edition.

    Microsoft has identified the known deviations from C++ Standards.  You probably won't have much trouble with those.

    2. You still need the /Za switch, and you set it in Visual C++ 2005 Express Edition from the Project Properties | C/C++ | Language | Disable Language Extensions option.

    Recommendations (3-4) in my previous note still apply.

    Saturday, January 28, 2006 5:29 PM

All replies

  • The VC team tries to be more conformant to the standard from one version of VC to another. For practicing, VC2005 should be applicable.

    Yes, console settings is the way to go.

    Thanks,
    Ayman Shoukry
    VC++ Team
    Saturday, January 28, 2006 3:22 PM
  • You can confine yourself to writing in ANSI/ISO Standard C and using the ANSI/ISO Standard C Libraries without too much difficulty.  The Microsoft statement of compliance explains the approach they've taken.

    There are some things you need to pay attention to:

    1.  Remember to name your source code with header (*.h) and C Language (*.c) extensions.   The compiler recognizes the difference between C (*.c) and C++ (*.cpp) automatically based on the filename extensions.

    When you have Visual C++ 2005 Express Edition installed, there are some additional settings that you need to employ (and this will make more sense when you have it installed to experiment with):

    2. Set your project options for using only standard features.  This involves setting the /Za option.  On your project properties in VC++ 2005 Express, check under general or language options.  The compiler will then warn you when your code uses a non-standard extension provided by Microsoft.

    3. Set your compiler diagnostics to a high warning level for starters.  You might want to back off a little later on, but first take advantage of all of the warnings and learn what they mean, how to overcome them with standard constructs, etc.

    4. As already mentioned, you are limited to developing Win32 Console Applications if you want to stay completely "pure."  That is a good way to start in any case, since there are so many tutorial materials and text books that work at this level.

    [I'd give more more-specific information with these tips but I see the computer that has my copy of VC++ 2005 on it has died and I need to install it on a different machine.  So, the other thing is to remember to back up all of your work!]

    Saturday, January 28, 2006 5:12 PM
  • Ah well, I must have Standard C on my mind at the moment.  I answered the wrong question.  You want to write standard C++, and you have more options. 

    1. With regard to ISO Standard C++, the extensions to use on files are *.h (or no extension on headers) and *.cpp. 

    There is a complete set of standard C++ libraries provided with the Visual C++ 2005 Express Edition.

    Microsoft has identified the known deviations from C++ Standards.  You probably won't have much trouble with those.

    2. You still need the /Za switch, and you set it in Visual C++ 2005 Express Edition from the Project Properties | C/C++ | Language | Disable Language Extensions option.

    Recommendations (3-4) in my previous note still apply.

    Saturday, January 28, 2006 5:29 PM
  • Thank you for information for both of you Ayman Shoukry and orcmid.

    I tried to answer earlier but installing or uninstalling takes a lot of time and during that time pc is useless. Well, now it is installed. Are we doing some kind of beta testing here.

    But I now have two ansi c++ compilers and at least the other one is working, so everything is well.

    Regards
    L M
    Sunday, January 29, 2006 4:53 PM
  • Hi

    Regarding your last sentence. I worried me a bit when installing/uninstalling hd light was on and nothing else happened. I remembered old times when that sometimes meant the hd was silently formatted.

    Installing time surely was from 180ms hd times.
    Sunday, January 29, 2006 5:00 PM