none
Any new keywords in C and C++ compared to early versions?

    Question

  • I'm wondering if any new keywords appeared in these languages over time compared to their early versions. That includes both: Microsoft specific and non-Microsoft specific keywords. If new keywords were presented for ANSI C/C++ and Microsoft C/C++ then which one of the specifications added new keywords more often. The answer will help to decide if suggestion not to use identifiers preceded with underscores because they are reserved for compiler implementations has any basis.
    Saturday, December 25, 2010 6:03 PM

Answers

  • Victor Stout wrote:

    I'm wondering if any new keywords appeared in these languages over  time compared to their early versions. That includes both:
    Microsoft specific*and non-Microsoft specific* keywords. If new  keywords were presented for ANSI C/C++ and Microsoft C/C++ then
    which one of the specifications added new keywords more often. The  answer will help to decide if suggestion not to use
    identifiers preceded with underscores because they are reserved for  compiler implementations has any basis.  

    http://msdn.microsoft.com/en-us/library/2e6a4at9(VS.71).aspx
    http://msdn.microsoft.com/en-us/library/2e6a4at9(VS.80).aspx
    http://msdn.microsoft.com/en-us/library/2e6a4at9(VS.85).aspx
    http://msdn.microsoft.com/en-us/library/2e6a4at9(VS.90).aspx
    http://msdn.microsoft.com/en-us/library/2e6a4at9(VS.100).aspx

    The first article lists 129 keywords, the last 150. I'll leave it as an  exercise for the reader to figure out which ones are new (frankly, I'm  too lazy for that).

    There currently exists only one version of C++ standard, commonly  referred to as C++98, and a "service pack" (formally, Technical  Corrigenda 1) referred to as C++03. Between the two, no new keywords  were added. The next version of C++ standard, nicknamed C++0x and  currently in draft form, does add a number of keywords, none of them of  the underscored variety (those are usually left for compiler-specific  extensions): alignof, char16_t, char32_t, constexpr, decltype, noexcept,  nullptr, thread_local


    Igor Tandetnik

    • Marked as answer by Victor Stout Saturday, December 25, 2010 7:37 PM
    Saturday, December 25, 2010 6:38 PM
  • Victor Stout wrote:

    It all comes down to the following: If any keywords not preceded with  underscore were added in newer versions of languages then
    there is no need to state that identifiers with underscores shouldn't  be used unless they are added at much faster paces than
    those without underscores.

    Compiler-specific features are naturally added much faster than standard  features. It takes at least 10 years to revise an ISO standard, but new  compiler versions are released every year or two. Consider also that  there are many different compilers, all busy adding extensions; e.g.  compare __declspec in MSVC and _attribute_ in GCC.

    Then there are macros - some predefined by the compiler, some defined in  standard headers. E.g. _MSC_VER or _GNUC_ or _TEXT or __RPC_FAR or  __inout


    Igor Tandetnik

    • Marked as answer by Victor Stout Saturday, December 25, 2010 7:17 PM
    Saturday, December 25, 2010 6:56 PM
  • Victor Stout wrote:

    What about ANSI C keywords?

    There are two versions of C standard, nicknamed C90 (sometimes, C89) and  C99. C99 added the following keywords: inline, restrict, _Bool,  _Complex, _Imaginary


    Igor Tandetnik

    • Marked as answer by Victor Stout Saturday, December 25, 2010 7:37 PM
    Saturday, December 25, 2010 7:24 PM

All replies

  • AFAIK, the restriction on underscores, etc. does not
    *just* apply to keywords. The implementation may use
    such labels in the implementation of compiler libraries
    as well. They are "reserved to the implementation for
    any use."

    - Wayne
    Saturday, December 25, 2010 6:20 PM
  • If to rephrase: Considering that identifiers with underscores are reserved for compiler implementations and should not be used by user-programmer. Are there any identifiers (preceded and not preceded with underscore/s) that were added by ANSI C/C++ and Microsoft C/C++ in the newest version compared to the oldest version? I would like to see the list of these identifiers if they exist.

    Saturday, December 25, 2010 6:31 PM
  • Victor Stout wrote:

    I'm wondering if any new keywords appeared in these languages over  time compared to their early versions. That includes both:
    Microsoft specific*and non-Microsoft specific* keywords. If new  keywords were presented for ANSI C/C++ and Microsoft C/C++ then
    which one of the specifications added new keywords more often. The  answer will help to decide if suggestion not to use
    identifiers preceded with underscores because they are reserved for  compiler implementations has any basis.  

    http://msdn.microsoft.com/en-us/library/2e6a4at9(VS.71).aspx
    http://msdn.microsoft.com/en-us/library/2e6a4at9(VS.80).aspx
    http://msdn.microsoft.com/en-us/library/2e6a4at9(VS.85).aspx
    http://msdn.microsoft.com/en-us/library/2e6a4at9(VS.90).aspx
    http://msdn.microsoft.com/en-us/library/2e6a4at9(VS.100).aspx

    The first article lists 129 keywords, the last 150. I'll leave it as an  exercise for the reader to figure out which ones are new (frankly, I'm  too lazy for that).

    There currently exists only one version of C++ standard, commonly  referred to as C++98, and a "service pack" (formally, Technical  Corrigenda 1) referred to as C++03. Between the two, no new keywords  were added. The next version of C++ standard, nicknamed C++0x and  currently in draft form, does add a number of keywords, none of them of  the underscored variety (those are usually left for compiler-specific  extensions): alignof, char16_t, char32_t, constexpr, decltype, noexcept,  nullptr, thread_local


    Igor Tandetnik

    • Marked as answer by Victor Stout Saturday, December 25, 2010 7:37 PM
    Saturday, December 25, 2010 6:38 PM
  • It all comes down to the following: If any keywords not preceded with underscore were added in newer versions of languages then there is no need to state that identifiers with underscores shouldn't be used unless they are added at much faster paces than those without underscores.

    Saturday, December 25, 2010 6:39 PM
  • Victor Stout wrote:

    If to rephrase: Considering that identifiers with underscores are  reserved for compiler implementations and should not be used
    by user-programmer. Are there any identifiers (preceded and not  preceded with underscore/s) that were added by ANSI C/C++ and
    Microsoft C/C++ in the newest version compared to the oldest version?  I would like to see the list of these identifiers if they
    exist.  

    STL implementation shipped with MSVC is chock full of identifiers with  leading underscores. Look inside <string> or <iostream> one of these  days. I suppose you could diff headers from different versions and  compile a list of differences, though I don't quite see what such an  exercise would achieve.


    Igor Tandetnik

    Saturday, December 25, 2010 6:41 PM
  • Igor Tandetnik, very good information. I would also like to know the same about C.
    Saturday, December 25, 2010 6:41 PM
  • STL implementation shipped with MSVC is chock full of identifiers with  leading underscores. Look inside <string> or <iostream> one of these  days. I suppose you could diff headers from different versions and  compile a list of differences, though I don't quite see what such an  exercise would achieve.

    But do they have a special meaning to the compiler as keywords or are they nothing more than a regular identifier any user-programmer can associate an integer value with for example?
    Saturday, December 25, 2010 6:45 PM
  • Victor Stout wrote:

    It all comes down to the following: If any keywords not preceded with  underscore were added in newer versions of languages then
    there is no need to state that identifiers with underscores shouldn't  be used unless they are added at much faster paces than
    those without underscores.

    Compiler-specific features are naturally added much faster than standard  features. It takes at least 10 years to revise an ISO standard, but new  compiler versions are released every year or two. Consider also that  there are many different compilers, all busy adding extensions; e.g.  compare __declspec in MSVC and _attribute_ in GCC.

    Then there are macros - some predefined by the compiler, some defined in  standard headers. E.g. _MSC_VER or _GNUC_ or _TEXT or __RPC_FAR or  __inout


    Igor Tandetnik

    • Marked as answer by Victor Stout Saturday, December 25, 2010 7:17 PM
    Saturday, December 25, 2010 6:56 PM
  • Victor Stout wrote:

    STL implementation shipped with MSVC is chock full of identifiers  with leading underscores. Look inside <string> or <iostream>
    one of these days. I suppose you could diff headers from different  versions and compile a list of differences, though I don't
    quite see what such an exercise would achieve. 

    But do they have a special meaning to the compiler as keywords or are  they nothing more than a regular identifier any
    user-programmer can associate an integer value with for example?

    They are regular identifiers. I don't quite see why it matters though:  when you write

    int __SomeVar;

    and your program no longer compiles, what difference does it make  whether it's broken because __SomeVar collided with a keyword, or with a  regular identifier in some standard header you need to include?


    Igor Tandetnik

    Saturday, December 25, 2010 7:00 PM
  • Victor Stout wrote:

    Igor Tandetnik, very good information. I would also like to know the  same about C.

    http://msdn.microsoft.com/en-us/library/befeaky0.aspx

    (use links on the top right to switch between versions).


    Igor Tandetnik

    Saturday, December 25, 2010 7:03 PM
  • Compiler-specific features are naturally added much faster than standard  features. It takes at least 10 years to revise an ISO standard, but new  compiler versions are released every year or two.
    That's what I needed to know.
    http://msdn.microsoft.com/en-us/library/befeaky0.aspx

    (use links on the top right to switch between versions).

    What about ANSI C keywords? But that's alright I already got the answer for the main question. Thank you.
    Saturday, December 25, 2010 7:15 PM
  • Victor Stout wrote:

    What about ANSI C keywords?

    There are two versions of C standard, nicknamed C90 (sometimes, C89) and  C99. C99 added the following keywords: inline, restrict, _Bool,  _Complex, _Imaginary


    Igor Tandetnik

    • Marked as answer by Victor Stout Saturday, December 25, 2010 7:37 PM
    Saturday, December 25, 2010 7:24 PM
  • Igor Tandetnik, awesome info. Thanks.

    Saturday, December 25, 2010 7:38 PM