Language Specification Version 4.0

Language Specification Version 4.0

# C Language Specification Version 4.0 Copyright Microsoft Corporation 1999-2010. All Rights Reserved. Please send corrections, comments, and other feedback to [email protected] Notice © 1999-2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Visual Basic, Visual C#, and Visual C++ are either registered trademarks or trademarks of Microsoft Corporation in the U.S.A. and/or other countries/regions. Other product and company names mentioned herein may be the trademarks of their respective owners. Copyright Microsoft Corporation 1999-2010. All Rights Reserved. Table of Contents Table of Contents 1. Introduction ....................................................................................................................................................... 1 1.1 Hello world .................................................................................................................................................... 1 1.2 Program structure .......................................................................................................................................... 2 1.3 Types and variables ....................................................................................................................................... 4 1.4 Expressions .................................................................................................................................................... 6 1.5 Statements ...................................................................................................................................................... 8 1.6 Classes and objects ...................................................................................................................................... 12 1.6.1 Members ............................................................................................................................................... 12 1.6.2 Accessibility .......................................................................................................................................... 13 1.6.3 Type parameters .................................................................................................................................... 13 1.6.4 Base classes ........................................................................................................................................... 14 1.6.5 Fields ..................................................................................................................................................... 14 1.6.6 Methods ................................................................................................................................................ 15 1.6.6.1 Parameters ...................................................................................................................................... 15 1.6.6.2 Method body and local variables ................................................................................................... 16 1.6.6.3 Static and instance methods ........................................................................................................... 17 1.6.6.4 Virtual, override, and abstract methods .......................................................................................... 18 1.6.6.5 Method overloading ....................................................................................................................... 20 1.6.7 Other function members ....................................................................................................................... 21 1.6.7.1 Constructors ................................................................................................................................... 22 1.6.7.2 Properties ........................................................................................................................................ 23 1.6.7.3 Indexers .......................................................................................................................................... 23 1.6.7.4 Events ............................................................................................................................................. 24 1.6.7.5 Operators ........................................................................................................................................ 24 1.6.7.6 Destructors ..................................................................................................................................... 25 1.7 Structs .......................................................................................................................................................... 25 1.8 Arrays .......................................................................................................................................................... 26 1.9 Interfaces ..................................................................................................................................................... 27 1.10 Enums ........................................................................................................................................................ 29 1.11 Delegates ................................................................................................................................................... 30 1.12 Attributes ................................................................................................................................................... 31 2. Lexical structure .............................................................................................................................................. 33 2.1 Programs ...................................................................................................................................................... 33 2.2 Grammars .................................................................................................................................................... 33 2.2.1 Grammar notation ................................................................................................................................. 33 2.2.2 Lexical grammar ................................................................................................................................... 34 2.2.3 Syntactic grammar ................................................................................................................................ 34 2.3 Lexical analysis ........................................................................................................................................... 34 2.3.1 Line terminators .................................................................................................................................... 35 2.3.2 Comments ............................................................................................................................................. 35 2.3.3 White space ........................................................................................................................................... 37 2.4 Tokens ......................................................................................................................................................... 37 2.4.1 Unicode character escape sequences..................................................................................................... 37 2.4.2 Identifiers .............................................................................................................................................. 38 2.4.3 Keywords .............................................................................................................................................. 39 2.4.4 Literals .................................................................................................................................................. 40 2.4.4.1 Boolean literals ............................................................................................................................... 40 2.4.4.2 Integer literals ................................................................................................................................. 40 Copyright Microsoft Corporation 1999-2010. All Rights Reserved. iii C# LANGUAGE SPECIFICATION 2.4.4.3 Real literals ..................................................................................................................................... 41 2.4.4.4 Character literals ............................................................................................................................ 42 2.4.4.5 String literals .................................................................................................................................. 43 2.4.4.6 The null literal ................................................................................................................................ 45 2.4.5 Operators and punctuators .................................................................................................................... 45 2.5 Pre-processing directives ............................................................................................................................. 45 2.5.1 Conditional compilation symbols ......................................................................................................... 46 2.5.2 Pre-processing expressions ..................................................................................................................

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    521 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us