Visual Studio syntax highlighting colors this word blue as if it were a keyword or reserved word. I tried searching online for it but the word "array" throws the search off, I get mostly pages explaining what an array is. What is it used for?
相关问题
- How to know full paths to DLL's from .csproj f
- Importing NuGet references through a local project
- Visual Studio 2019 - error MSB8020: The build tool
- How to get the maximum of more than 2 numbers in V
- 'System.Threading.ThreadAbortException' in
相关文章
- How to show location of errors, references to memb
- Numpy matrix of coordinates
- How to track MongoDB requests from a console appli
- Visual Studio Hangs on Loading UI Library
- How to use Mercurial from Visual Studio 2010?
- PHP: Can an array have an array as a key in a key-
- Accessing an array element when returning from a f
- How can I convert a PHP function's parameter l
It is not a reserved word, but Microsoft visual studio decided to mark it blues as if it were a reserved word, but it most definitely is not according to "C++ Programming 5th Edition" by D.D. Malik.
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:
ISO C++98 Keywords:
In what edition? A Google search for "c++ reserved words" shows no such usage.
I routinely use "array" in sample code.
http://cs.smu.ca/~porter/csc/ref/cpp_keywords.html
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."
Visual Studio never bothered with defining different C++ grammars for their pretty printer. ISO C++, VC++, C++/CLI, or just old C - all share the same grammar. So, names like array and interface are all treated as if they were keywords.
It would also be quite hard for the pretty printer to spot the C++ dialect used in foo.cpp. You'd need to compile the code for that. Currently the pretty printer can operate on tokens, which means it only needs to parse the code.