[ACCEPTED]-Why is "array" marked as a reserved word in Visual-C++?-c++-cli
It's not a reserved word under ISO standards. Microsoft's 5 C++/CLI defines array in the cli namespace, and Visual Studio's syntax 4 highlighting will treat it as a reserved 3 word. This usage would be considered a vendor 2 extension and not a part of any international 1 C or C++ standard.
ISO C99 Keywords:
auto enum restrict unsigned break extern return void case float short volatile char for signed while const goto sizeof _Bool continue if static _Complex default inline struct _Imaginary do int switch double long typedef else 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_eq delete namespace switch do new template
It isn't. At least not in standard C/C++.
Now 3 you might well ask the reason "entry" was a reserved word in C in K&R but not in C99 - somebody 2 thought they might add the feature at some 1 point, but eventually decided against it.
It's used in C++/CLI.
Visual C++ Language Reference: "The array keyword 3 lets you create a dynamic array that is 2 allocated on the common language runtime 1 heap."
Visual Studio never bothered with defining 10 different C++ grammars for their pretty 9 printer. ISO C++, VC++, C++/CLI, or just 8 old C - all share the same grammar. So, names 7 like array and interface are all treated 6 as if they were keywords.
It would also be 5 quite hard for the pretty printer to spot 4 the C++ dialect used in foo.cpp. You'd need 3 to compile the code for that. Currently 2 the pretty printer can operate on tokens, which 1 means it only needs to parse the code.
In what edition? A Google search for "c++ reserved 2 words" shows no such usage.
I routinely 1 use "array" in sample code.
It is not a reserved word, but Microsoft 4 Visual Studio decided to mark it blue as 3 if it were a reserved word, but it most 2 definitely is not according to "C++ Programming 1 5th Edition" by D.D. Malik.
The fact that a word's being highlighted 3 in MSVC doesn't mean that it's a C or C++ keyword. As 2 you can see, it also highlights many non-standard 1 things like __int64
, or even __int128
although there's no 128-bit int type in MSVC.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.