Is VB really case insensitive?

后端 未结 14 2082
名媛妹妹
名媛妹妹 2020-11-30 05:28

I\'m not trying to start an argument here, but for whatever reason, it\'s typically stated that Visual Basic is case insensitive and C languages aren\'t (and somehow that is

14条回答
  •  悲哀的现实
    2020-11-30 05:42

    VB is case preserving (in the IDE) but case insensitive. It's like Windows file system in a way. Hello.txt and hello.txt are considered to be the same file name.

    The IDE assumes that the declaration a variable is the "correct" case for that variable, and adjusts every instance of that variable match the declaration. It does this for eye-candy and consistency reasons, but not for functionality.

    I've seen several instances where the case was not automatically changed to match the declaration, and the statement works just the same. You can also use any text editor to write code that will compile just fine in different cases.

    A side-note:

    Most PEOPLE think in a case-insensitive manner. When we see the word "dog" the word is translated into meaning in our minds. The meaning of the word is not based upon case (i.e. regardless of if spell it "DOG", "DoG", or "dOG" still barks.) COMPUTERS see words as discrete bags of bits. Uppercase and lowercase are different bit patterns, and are thus different.

    Since most programmers are human, case insensitivity seems more adapted to the way people think and case sensitivity is more about humans adapting how they think to the constraints of a machine.

提交回复
热议问题