Array Keyword???

closed account (LN7oGNh0)
Ive looked this up and the websites usually say that it isnt a keyword - reserved word (whatever you like) and then they explain what an array is. Im using Visual C++ 2010 and when I type 'array' it goes blue like any other keyword. (such as 'int') If an array is declared using this '[]' after the name of the variable, whats the point of using a keyword?
from my knowledge "array" is not a keyword, so therefore you could not use it to declare an array. And if it does consider it a keyword, it would enforce my idea not to trust a product of microsoft.

also a quick google search comes up with answers, one of which is:
http://stackoverflow.com/questions/372580/why-is-array-a-reserved-word-in-c-c
Last edited on
closed account (LN7oGNh0)
Ya, I read that and everyone there just kepps sayiong that it isnt a keyword?
When array is typed in, the text becomes blue instead of black. This must mean it is a keyword because the same thing happens with other keywords.(again, such as int)

Is there a use for it?
they answered it in that thread:


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.


and

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.


so apparently its a microsoft thing, nothing related to the standard c++

for example attempting to declare an array with "array" results in an error in everything other than your IDE.
Last edited on
closed account (LN7oGNh0)
So its basically like how they used 'void main'.
each IDE will have its own default code they throw in when you make a new main.cpp, just make it int main() and return 0 at the end.

Use a different IDE (not microsoft) and you will see "array" is not highlighted as a keyword, because microsoft created it.
Last edited on
closed account (LN7oGNh0)
Ya, I know that, but why does microsoft put all this stuff that a whole load of people disapprove of?
closed account (z05DSL3A)
array is a keyword in C++/CLI.


Edit:
experiencing some lag in message updates today.
Last edited on
thats why i use linux. There are a lot of things Microsoft forces upon its users that linux, allows you to config, etc.

Once you go linux you dont go back.

Thats just an IDE made by Microsoft, dont get me started on their OS. lol

EDIT: You may be able to change the default settings of the keywords etc, I dont know. You would have to check your IDE's configuration.
Last edited on
closed account (LN7oGNh0)
OK. Then what does it do in 'C++/CLI'?
did you read that thread?

Microsoft's C++/CLI defines array in the cli namespace,
closed account (LN7oGNh0)
Thanks everyone for all the answers!
Topic archived. No new replies allowed.