VC2005 - where keyword?

This is a discussion on VC2005 - where keyword? within the C++ Programming forums, part of the General Programming Boards category; In VC++ 2005, I have something like this; Code: type where; With me wanting to call my variable 'where'. Peculiarly, ...

  1. #1
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465

    VC2005 - where keyword?

    In VC++ 2005, I have something like this;

    Code:
    type where;
    With me wanting to call my variable 'where'. Peculiarly, the editor colored the identifier 'where', but allowed me to compile it. Is there something crazy going on?

    ╔╗╔╦══╦╗╔╦══╦╗
    ║╚╝║╔╗║╚╝║╔╗║║
    ║╔╗║╠╣║╔╗║╠╣╠╣
    ╚╝╚╩╝╚╩╝╚╩╝╚╩╝

    codez http://code.google.com/p/zxcvbn/

  2. #2
    Cat
    Cat is offline
    Registered User
    Join Date
    May 2003
    Posts
    1,571
    It's a keyword in C++/CLI which VC++ can compile if you tell it to.

    It's also a proposed keyword in C++0x so I'd avoid using it as an identifier.
    You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.

  3. #3
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    What would it mean?
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  4. #4
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,436
    I believe it will be used for early type checking of template arguments. Something that is missing from the current specification.

    However some discussions seem to indicate the introduction of 'where' as a keyword is unlikely. There is too much code that uses it as identifiers. Think of geographic software for instance...

    An alternative seems to be requires

    EDIT: http://www.open-std.org/jtc1/sc22/wg...006/n2105.html
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  5. #5
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,231
    Microsoft C++ IDE is for both C++ and C++/CLI. So it paints "where" word. It is a keyword in C++/CLI and undeclared word in C++.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  6. #6
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,436
    > Microsoft C++ IDE is for both C++ and C++/CLI. So it paints "where" word.

    Nope.
    I think even Microsoft IDE is smart enough not to use one language parser on a project file of another language.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  7. #7
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,231
    Wrong, it is not.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

  8. #8
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,436
    Oh boy! You seem so sure of yourself, don't you?

    Do yourself a favor and open a native C++ project on your editor and type C#'s 'base' or C++/CLI's 'generic'.

    EDIT: BTW, other editors also colorize 'where'. The answer why was already given by Cat on his second paragraph.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  9. #9
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,231
    Lol, why you didn't try that yourself? It could prevent you from posting your last post. It paints the generic. Because the IDE doesn't know if you will compile the code with /clr or not.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. keyword replacement
    By JackBear in forum C Programming
    Replies: 11
    Last Post: 05-18-2007, 10:54 PM
  2. Virtual Keyword
    By Shal in forum C++ Programming
    Replies: 6
    Last Post: 05-18-2006, 11:37 AM
  3. extern keyword
    By trekker in forum C Programming
    Replies: 7
    Last Post: 06-01-2005, 01:31 PM
  4. 'new' keyword
    By pktcperlc++java in forum C++ Programming
    Replies: 4
    Last Post: 02-28-2005, 08:31 PM
  5. how to search a keyword in C?
    By kreyes in forum C Programming
    Replies: 2
    Last Post: 03-01-2002, 07:22 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21