Why is "array" marked as a reserved word in Visual-C++? Why is "array" marked as a reserved word in Visual-C++? arrays arrays

Why is "array" marked as a reserved word in Visual-C++?


It's not a reserved word under ISO standards. Microsoft's C++/CLI defines array in the cli namespace, and Visual Studio's syntax highlighting will treat it as a reserved word. This usage would be considered a vendor extension and not a part of any international C or C++ standard.

ISO C99 Keywords:

auto        enum        restrict    unsignedbreak       extern      return      voidcase        float       short       volatilechar        for         signed      whileconst       goto        sizeof      _Boolcontinue    if          static      _Complexdefault     inline      struct      _Imaginarydo          int         switchdouble      long        typedefelse        register    union

ISO C++98 Keywords:

and         double          not                 this and_eq      dynamic_cast    not_eq              throw asm         else            operator            true auto        enum            or                  try bitand      explicit        or_eq               typedef bitor       export          private             typeid bool        extern          protected           typename break       false           public              union case        float           register            unsigned catch       for             reinterpret_cast    using char        friend          return              virtual class       goto            short               void compl       if              signed              volatile const       inline          sizeof              wchar_t const_cast  int             static              while continue    long            static_cast         xor default     mutable         struct              xor_eqdelete      namespace       switch     do          new             template


It isn't. At least not in standard C/C++.

Now you might well ask the reason "entry" was a reserved word in C in K&R but not in C99 - somebody thought they might add the feature at some point, but eventually decided against it.


It's used in C++/CLI.

Visual C++ Language Reference: "The array keyword lets you create a dynamic array that is allocated on the common language runtime heap."