Turbo Pascal 7 Language

Total Page:16

File Type:pdf, Size:1020Kb

Turbo Pascal 7 Language 7.0 LANGUAGE GUIDE • LANGUAGE DEFINITION • STANDARD UNITS • MEMORY MANAGEMENT • ASSEMBLY LANGUAGE B 0 R L 'A N D Turbo Pasca/® Version 7.0 Language Guide BORLAND INTERNATIONAL INC. 1800 GREEN HILLS ROAD P.O. BOX 660001, scons VALLEY, CA 95067-0001 Copyright © 1983, 1992 by Borland International. All rights reserved. All Borland products are trademarks or registered trademarks of Borland International, Inc. Windows, as used in this manual, shall refer to Microsoft's implementation of a windows system. Other brand and product names are trademarks or registered trademarks of their respective holders. PRINTED IN THE USA. Rl 10 9 8 c o N T E N T s Introduction 1 Real types . .. 28 What's in this manual .................. 2 Software floating point ........... 29 80x87 floating point .............. 29 Part 1 The Turbo Pascal language String types ......................... 29 Chapter 1 What is a Turbo Pascal Structured types ..................... 30 progrnm? 5 Array types ....................... 30 A Turbo Pascal program ............... 5 Record types ...................... 32 Procedures and functions .............. 6 Object types . .. 33 Statements ........................... 8 Components and scope ........... 36 Expressions .......................... 9 Methods ........................ 37 Tokens ............................. 10 Virtual methods ................. 37 Types, variables, constants, and typed Dynamic methods ............... 38 constants ........................... 10 Instantiating objects . .. 38 Putting it all together . .. 11 Method activations ............... 40 Units ............................... 13 Qualified-method activations . .. 41 Syntax diagrams ..................... 14 Set types . .. 42 File types ......................... 42 Chapter 2 Tokens 15 Pointer types ......... .. 43 Special symbols . .. 15 Type Pointer ...................... 43 Reserved words and standard directives. 16 Type PChar ....................... 43 Identifiers . .. 17 Procedural types ..................... 44 Numbers ........................... 18 Procedural values . .. 44 Labels .............................. 19 Type compatibility . .. 46 Character strings . .. 19 Identical and compatible types ......... 46 Comments .......................... 20 Type identity . .. 46 Program lines ....................... 20 Type compatibility ................. 47 Assignment compatibility ........... 48 Chapter 3 Constants 21 The type declaration part ............. 49 Chapter 4 Types 23 Chapter 5 Variables and typed Simple types ........................ 23 constants 51 Ordinaltypes ...................... 24 Variable declarations ................. 51 Integertypes .................... 25 The data segment .................. 52 Boolean types ................... 25 The stack segment ................. 52 Char type .. .. 26 Absolute variables ................. 53 Enumerated types. .. 26 Variable references ................ 53 Subrange types .................. 27 Qualifiers ......................... 54 Chapter 7 Statements 81 Arrays, strings, and indexes ....... 55 Simple statements. .. 81 Records and field designators . .. 55 Assignment statements ............. 82 Object component designators ..... 56 Object-type assignments .......... 82 Pointers and dynamic variables .... 56 Procedure statements. .. 82 Variable typecasts . .. 57 Goto statements ................... 83 Typed constants ..................... 58 Structured statements ................ 83 Simple-type constants .............. 59 Compound statements . .. 84 String-type constants ............... 60 Conditional statements ............. 84 Structured-type constants ........... 60 If statements .................... 84 Array-type constants ............. 60 Case statements ................. 85 Record-type constants ............ 62 Repetitive statements . .. 87 Object-type constants . .. 62 Repeat statements. .. 87 Set-type constants . .. 63 While statements ................ 87 Pointer-type constants .......... .. 63 For statements . .. 88 Procedural-type constants . .. 64 With statements ................... 90 Chapter 6 Expressions 65 Chapter 8 Blocks, locality, and Expression syntax .................... 66 scope 93 Operators . .. 68 Blocks ............................. '. 93 Arithmetic operators ............... 68 Rules of scope ....................... 95 Logicaloperators .................. 69 Block scope ....................... 95 Boolean operators .................. 70 Record scope . .. 95 String operator .................... 71 Object scope. .. 96 Character-pointer operators ......... 71 Unit scope ........................ 96 Set operators ...................... 72 Relational operators ................ 73 Chapter 9 Procedures and functions 97 Comparing simple types .......... 73 Procedure declarations ............... 97 Comparing strings ............... 74 Near and far declarations ........... 98 Comparing packed strings ........ 74 Interrupt declarations .............. 99 Comparing pointers . .. 74 Forward declarations ............... 99 Comparing character pointers ..... 74 External declarations .............. 100 Comparing sets . .. 74 Assembler declarations ............ 101 Testing set membership ........... 75 Inline declarations ................ 101 The @ operator ..................... 75 Function declarations ................ 101 @ with a variable. .. 75 Method declarations ................ 103 @ with a procedure, function, or Constructors and destructors ..... 104 method ......................... 75 Constructor-error recovery ....... 106 Function calls ....................... 76 Parameters ......................... 107 Set constructors ...................... 76 Value parameters ................. 108 Value typecasts .. .. 77 Constant parameters .............. 109 Procedural types in expressions . .. 78 Variable parameters ............... 109 Untyped parameters .............. 110 Open parameters ................. 111 Open-string parameters . .. 111 The NUL device ................ 141 Open-array parameters .......... 113 Text-file devices .................. 141 Dynamic object-type variables ........ 114 Input and output with the Crt unit .... 142 U sing the Crt unit . .. 142 Chapter 10 Programs and units 117 Windows ........................ 142 Program syntax. .. 117 Special characters ............... 143 The program heading ............. 117 Line input ..................... 143 The uses clause ................... 117 Crt procedures and functions ....... 144 Unit syntax ........................ 118 Crt unit constants and variables . .. 145 The unit heading .................. 118 Text-file device drivers .............. 146 The interface part ................. 119 The Open function ................ 147 The implementation part ........... 119 The InOut function ................ 147 The initialization part. .. 120 The Flush function ................ 147 Indirect unit references ............ 120 The Close function ................ 148 Circular unit references ............ 121 Sharing other declarations ........ 123 Chapter 14 Using the SOx8? 149 The 80x87 data types ................ 151 Part 2 The run-time library Extended range arithmetic ........... 152 Chapter 11 Overview of the run-time Comparing reals . .. 153 library 127 The 80x87 evaluation stack ........... 153 Writing reals with the 80x87 . .. 155 Chapter 12 Standard procedures and Units using the 80x87 ................ 155 functions 129 Detecting the 80x87 ............... 155 Flow-control procedures ......... 130 Emulation in assembly language . .. 157 Transfer functions . .. 130 Arithmetic functions ............ 130 Chapter 15 Interfacing with DOS 159 Ordinal procedures and functions. 131 Dos unit procedures and functions .... 160 String procedures and functions .. 131 Dos unit constants, types, and Dynamic-allocation procedures and variables. .. .. 162 functions ...................... 132 Constants . .. 162 Pointer and address functions .... 132 Types ........................... 163 Miscellaneous routines .......... 133 Variables ...................... 163 Predeclared variables . .. 133 WinDos unit procedures and functions . 163 WinDos unit constants, types, and Chapter 13 Input and output 135 variables . .. 165 File input and output . .. 136 Constants . .. 165 Text files . .. 137 Types ........................... 166 Untyped files ..................... 139 Variables ........................ 166 The FileMode variable . .. 139 Devices in Turbo Pascal . .. 140 Chapter 16 Using null-terminated DOS devices ..................... 140 strings 167 The CON device ................ 140 What is a null-terminated string? . .. 167 The LPTl, LPT2, and LPT3 devices. 141 Strings unit functions ................ 167 The COM1 and COM2 devices .... 141 Using null-terminated strings ......... 169 Character pointers and string literals . 169 iii Character pointers and character Part 3 Inside Turbo Pascal arrays ........................... 171 Character pointer indexing . .. 171 Chapter 19 Memory issues 209 Null-terminated strings and standard The Turbo Pascal memory map ....... 209 procedures ....................... 173 The heap manager .................. 211 An example using string-handling Disposal methods . .. 212 functions ........................ 173 The free list ...................... 215 The HeapError variable . .. 217 Chapter 17 Using the Borland Internal data formats ................ 218 Graphics Interface 175 Integer types ..................... 218 Drivers ............................ 175 Char types ....................... 218 IBM 8514 support .........
Recommended publications
  • Chapter 5 Names, Bindings, and Scopes
    Chapter 5 Names, Bindings, and Scopes 5.1 Introduction 198 5.2 Names 199 5.3 Variables 200 5.4 The Concept of Binding 203 5.5 Scope 211 5.6 Scope and Lifetime 222 5.7 Referencing Environments 223 5.8 Named Constants 224 Summary • Review Questions • Problem Set • Programming Exercises 227 CMPS401 Class Notes (Chap05) Page 1 / 20 Dr. Kuo-pao Yang Chapter 5 Names, Bindings, and Scopes 5.1 Introduction 198 Imperative languages are abstractions of von Neumann architecture – Memory: stores both instructions and data – Processor: provides operations for modifying the contents of memory Variables are characterized by a collection of properties or attributes – The most important of which is type, a fundamental concept in programming languages – To design a type, must consider scope, lifetime, type checking, initialization, and type compatibility 5.2 Names 199 5.2.1 Design issues The following are the primary design issues for names: – Maximum length? – Are names case sensitive? – Are special words reserved words or keywords? 5.2.2 Name Forms A name is a string of characters used to identify some entity in a program. Length – If too short, they cannot be connotative – Language examples: . FORTRAN I: maximum 6 . COBOL: maximum 30 . C99: no limit but only the first 63 are significant; also, external names are limited to a maximum of 31 . C# and Java: no limit, and all characters are significant . C++: no limit, but implementers often impose a length limitation because they do not want the symbol table in which identifiers are stored during compilation to be too large and also to simplify the maintenance of that table.
    [Show full text]
  • A Concurrent PASCAL Compiler for Minicomputers
    512 Appendix A DIFFERENCES BETWEEN UCSD'S PASCAL AND STANDARD PASCAL The PASCAL language used in this book contains most of the features described by K. Jensen and N. Wirth in PASCAL User Manual and Report, Springer Verlag, 1975. We refer to the PASCAL defined by Jensen and Wirth as "Standard" PASCAL, because of its widespread acceptance even though no international standard for the language has yet been established. The PASCAL used in this book has been implemented at University of California San Diego (UCSD) in a complete software system for use on a variety of small stand-alone microcomputers. This will be referred to as "UCSD PASCAL", which differs from the standard by a small number of omissions, a very small number of alterations, and several extensions. This appendix provides a very brief summary Of these differences. Only the PASCAL constructs used within this book will be mentioned herein. Documents are available from the author's group at UCSD describing UCSD PASCAL in detail. 1. CASE Statements Jensen & Wirth state that if there is no label equal to the value of the case statement selector, then the result of the case statement is undefined. UCSD PASCAL treats this situation by leaving the case statement normally with no action being taken. 2. Comments In UCSD PASCAL, a comment appears between the delimiting symbols "(*" and "*)". If the opening delimiter is followed immediately by a dollar sign, as in "(*$", then the remainder of the comment is treated as a directive to the compiler. The only compiler directive mentioned in this book is (*$G+*), which tells the compiler to allow the use of GOTO statements.
    [Show full text]
  • VERSION 2.0 Referene MANUAL
    VERSION 2.0 REFERENe MANUAL BORlAnD INTERNATIONAL Borland International 4113 Scotts Valley Drive Scotts Valley, California 95066 Copyright Notice© This software package and manual are copyrighted 1983, 1984 by BORLAND INTERNATIONAL Inc. All rights reserved worldwide. No part of this publication may be reproduced, transmitted, transcribed, stored in any retrieval system, or translated into any language by any means without the express written per­ mission of BORLAND INTERNATIONAL Inc., 4113 Scotts Valley Drive, Scotts Valley, CA 95066, USA. Single CPU License The price paid for one copy of TURBO Pascal licenses you to use the product on one CPU when and only when you have signed and returned the License Agreement printed in this book. Disclaimer Borland International makes no warranties as to the contents of this manual and specifically disclaims any implied warranties of merchantability or fitness for any particular purpose. Borland International further reserves the right to make changes to the specifications of the program and contents of the manual without obligation to notify any person or organization of such changes. Fifth edition, October 1984 Printed in the United States of America 98765 TABLE OF CONTENTS INTRODUCTION ............................................. 1 The Pascal Language .........................................1 TURBO Pascal ..............................................1 Structure of This Manual ..................................... 2 Typography ............................................... 3 Syntax Descriptions
    [Show full text]
  • TURBO Pascal Tutor·
    The TURBO Pascal Tutor· A Self-Study Guide to TURBO Pascal Copyright @1984 Copyright @1985 BORLAND INTERNATIONAL, INC. 4585 Scotts Valley Drive Scotts Valley, CA 95066 U.S.A. Borland's No-Nonsense License Statement! This software is protected by both United States Copyright Law and International Treaty provisions. Therefore you must treat this software just like a book with the following single exception. Borland International authorizes you to make archival copies of the software for the sole purpose of backing-up your software and protecting your investment from loss. By saying, "just like a book", Borland means for example that this software may be used by any number of people and may be freely moved from one computer location to another so long as there is No Possibility of it being used at one location while it's being used at another. Just like a book that can't be read by two different people in two different places at the same time, neither can the software be used by two different people in two different places at the same time. (Unless, of course, Borland's Copyright has been violated.) WARRANTY With respect to the physical diskette and physical documentation enclosed herein, BORLAND INTERNATIONAL, INC., ("BORLAND") warrants the same to be free of defects in materials and workmanship for a period of 30 days from the date of purchase. In the event of notification within the warranty period of defects in material or workmanship, BORLAND will replace the defective diskette or documentation. The remedy for breach of this warranty shall be limited to replacement and· shall not encompass any other damages, including but not limited to loss of profit, special, incidental, consequential, or other similar claims.
    [Show full text]
  • Concise Introduction to C++
    i i final3 2012/4/19 page 47 i i Chapter 2 Concise Introduction to C++ C++ seems to be most suitable for many practical applications. Indeed, C++ is sufficiently high-level to allow transparent object-oriented programming and efficient use of human resources, yet is also sufficiently low-level to have types, variables, pointers, arrays, and loops to allow efficient use of computer resources. In this chapter, we give a concise description of C++ and illustrate its power as an object-oriented programming language. In particular, we show how to construct and use abstract mathematical objects such as vectors and matrices. We also explain the notion of a template class, which can be filled with a concrete type later on in compilation time. We also discuss inheritance and illustrate its potential. 2.1 Objects As we have seen above, C is a language based on functions. Every command is also a function that returns a value that can be further used or abandoned, according to the wish of the programmer. Furthermore, programmers can write their own functions, which may also return variables of the type specified just before the function name. When the function is called, a temporary, unnamed variable is created to store the returned value until it has been used. C++, on the other hand, is an object-oriented programming language. In this kind of language, the major concern is not the functions that can be executed but rather the objects upon which they operate. Although C++ supports all the operations and features available in C, its point of view is different.
    [Show full text]
  • Concepts in Programming Languages Practicalities
    Concepts in Programming Languages Practicalities I Course web page: Alan Mycroft1 www.cl.cam.ac.uk/teaching/1617/ConceptsPL/ with lecture slides, exercise sheet and reading material. These slides play two roles – both “lecture notes" and “presentation material”; not every slide will be lectured in Computer Laboratory detail. University of Cambridge I There are various code examples (particularly for 2016–2017 (Easter Term) JavaScript and Java applets) on the ‘materials’ tab of the course web page. I One exam question. www.cl.cam.ac.uk/teaching/1617/ConceptsPL/ I The syllabus and course has changed somewhat from that of 2015/16. I would be grateful for comments on any remaining ‘rough edges’, and for views on material which is either over- or under-represented. 1Acknowledgement: various slides are based on Marcelo Fiore’s 2013/14 course. Alan Mycroft Concepts in Programming Languages 1 / 237 Alan Mycroft Concepts in Programming Languages 2 / 237 Main books Context: so many programming languages I J. C. Mitchell. Concepts in programming languages. Cambridge University Press, 2003. Peter J. Landin: “The Next 700 Programming Languages”, I T.W. Pratt and M. V.Zelkowitz. Programming Languages: CACM (published in 1966!). Design and implementation (3RD EDITION). Some programming-language ‘family trees’ (too big for slide): Prentice Hall, 1999. http://www.oreilly.com/go/languageposter http://www.levenez.com/lang/ ? M. L. Scott. Programming language pragmatics http://rigaux.org/language-study/diagram.html (4TH EDITION). http://www.rackspace.com/blog/ Elsevier, 2016. infographic-evolution-of-computer-languages/ I R. Harper. Practical Foundations for Programming Plan of this course: pick out interesting programming-language Languages.
    [Show full text]
  • Java Terms/Concepts You Should Know from OOPDA Glossary Terms
    Java Terms/Concepts You Should Know from OOPDA A abstract class A class with the abstract reserved word in its header. Abstract classes are distinguished by the fact that you may not directly construct objects from them using the new operator. An abstract class may have zero or more abstract methods. abstract method A method with the abstract reserved word in its header. An abstract method has no method body. Methods defined in an interface are always abstract. The body of an abstract method must be defined in a sub class of an abstract class, or the body of a class implementing an interface. Abstract Windowing Toolkit The Abstract Windowing Toolkit (AWT) provides a collection of classes that simplify the creation of applications with graphical user interfaces. These are to be found in the java.awt packages. Included are classes for windows, frames, buttons, menus, text areas, and so on. Related to the AWT classes are those for the Swing packages. aggregation A relationship in which an object contains one or more other subordinate objects as part of its state. The subordinate objects typically have no independent existence separate from their containing object. When the containing object has no further useful existence, neither do the subordinate objects. For instance, a gas station object might contain several pump objects. These pumps will only exist as long as the station does. Aggregation is also referred to as the has-a relationship, to distinguish it from the is-a relationship, which refers to inheritance. anonymous class A class created without a class name.
    [Show full text]
  • Intel ® Fortran Programmer's Reference
    ® Intel Fortran Programmer’s Reference Copyright © 1996-2003 Intel Corporation All Rights Reserved Issued in U.S.A. Version Number: FWL-710-02 World Wide Web: http://developer.intel.com Information in this document is provided in connection with Intel products. No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted by this document. EXCEPT AS PROVIDED IN INTEL’S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSO- EVER, AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PAR- TICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. Intel products are not intended for use in medical, life saving, or life sustaining applications. This Intel® Fortran Programmer’s Reference as well as the software described in it is furnished under license and may only be used or copied in accordance with the terms of the license. The information in this manual is furnished for infor- mational use only, is subject to change without notice, and should not be construed as a commitment by Intel Corpora- tion. Intel Corporation assumes no responsibility or liability for any errors or inaccuracies that may appear in this document or any software that may be provided in association with this document. Designers must not rely on the absence or characteristics of any features or instructions marked "reserved" or "unde- fined." Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibil- ities arising from future changes to them.
    [Show full text]
  • PHP Advanced and Object-Oriented Programming
    VISUAL QUICKPRO GUIDE PHP Advanced and Object-Oriented Programming LARRY ULLMAN Peachpit Press Visual QuickPro Guide PHP Advanced and Object-Oriented Programming Larry Ullman Peachpit Press 1249 Eighth Street Berkeley, CA 94710 Find us on the Web at: www.peachpit.com To report errors, please send a note to: [email protected] Peachpit Press is a division of Pearson Education. Copyright © 2013 by Larry Ullman Acquisitions Editor: Rebecca Gulick Production Coordinator: Myrna Vladic Copy Editor: Liz Welch Technical Reviewer: Alan Solis Compositor: Danielle Foster Proofreader: Patricia Pane Indexer: Valerie Haynes Perry Cover Design: RHDG / Riezebos Holzbaur Design Group, Peachpit Press Interior Design: Peachpit Press Logo Design: MINE™ www.minesf.com Notice of Rights All rights reserved. No part of this book may be reproduced or transmitted in any form by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of the publisher. For information on getting permission for reprints and excerpts, contact [email protected]. Notice of Liability The information in this book is distributed on an “As Is” basis, without warranty. While every precaution has been taken in the preparation of the book, neither the author nor Peachpit Press shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the instructions contained in this book or by the computer software and hardware products described in it. Trademarks Visual QuickPro Guide is a registered trademark of Peachpit Press, a division of Pearson Education. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks.
    [Show full text]
  • BORLAND Turbo Pascafbj Version 6.0
    BORLAND Turbo PascafBJ Version 6.0 Turbo Vision Guide BORLAND INTERNATIONAL INC. 1800 GREEN HILLS ROAD P.O. BOX 660001, scons VALLEY, CA 95067-0001 Copyright © 1990 by Borland International. All rights reserved. All Borland products are trademarks or registered trademarks of Borland International, Inc. Other brand and product names are trademarks or registered trademarks of their respective holders. PRINTED IN THE USA. R2 10 9 8 7 6 5 4 3 2 1 c o N T E N T s Introduction 1 Chapter 2 Writing Turbo Vision Why Turbo Vision? ................... 1 applications 23 What is Turbo Vision? ................. 1 Your first Turbo Vision application . .. 23 What you need to know ............... 2 The desktop, menu bar, and status line .. 25 What's in this book? ................... 2 The desktop . .. 26 The status line . .. 26 Part 1 Learning Turbo Vision Creating new commands. .. 27 Chapter 1 Inheriting the wheel 7 The menu bar ..................... 28 The framework of a windowing A note on structure . .. 30 application . .. 7 Opening a window. .. 31 A new Vision of application development. 8 Standard window equipment . .. 31 The elements of a Turbo Vision Window initialization .............. 33 application . .. 9 The Insert method ............... 33 Naming of parts .................... 9 Closing a window. .. 34 Views ........................... 9 Window behavior . .. 34 Events ........................... 9 Look through any window . .. 35 Mute objects. .. 10 What do you see? .................. 37 A common "look and feel" .......... 10 A better way to Write. .. 38 "Hello, World!" Turbo Vision style ..... 12 A simple file viewer .. .. 38 Running HELLO.PAS .............. 13 Reading a text file .. .. 39 Pulling down a menu. .. 14 Buffered drawing .................
    [Show full text]
  • Software II: Principles of Programming Languages Control Statements
    Software II: Principles of Programming Languages Lecture 8 – Statement-Level Control Structures Control Statements: Evolution • FORTRAN I control statements were based directly on IBM 704 hardware • Much research and argument in the 1960s about the issue – One important result: It was proven that all algorithms represented by flowcharts can be coded with only two-way selection and pretest logical loops Control Structure • A control structure is a control statement and the statements whose execution it controls • Design question – Should a control structure have multiple entries? Selection Statements • A selection statement provides the means of choosing between two or more paths of execution • Two general categories: – Two-way selectors – Multiple-way selectors Two-Way Selection Statements • General form: if control_expression then clause else clause • Design Issues: – What is the form and type of the control expression? – How are the then and else clauses specified? – How should the meaning of nested selectors be specified? The Control Expression • If the then reserved word or some other syntactic marker is not used to introduce the then clause, the control expression is placed in parentheses • In C89, C99, Python, and C++, the control expression can be arithmetic • In most other languages, the control expression must be Boolean Clause Form • In many contemporary languages, the then and else clauses can be single statements or compound statements • In Perl, all clauses must be delimited by braces (they must be compound) • In Fortran
    [Show full text]
  • Software II: Principles of Programming Languages Introduction
    Software II: Principles of Programming Languages Lecture 5 – Names, Bindings, and Scopes Introduction • Imperative languages are abstractions of von Neumann architecture – Memory – Processor • Variables are characterized by attributes – To design a type, must consider scope, lifetime, type checking, initialization, and type compatibility Names • Design issues for names: – Are names case sensitive? – Are special words reserved words or keywords? Names (continued) • Length – If too short, they cannot be connotative – Language examples: • FORTRAN 95: maximum of 31 (only 6 in FORTRAN IV) • C99: no limit but only the first 63 are significant; also, external names are limited to a maximum of 31 (only 8 are significant K&R C ) • C#, Ada, and Java: no limit, and all are significant • C++: no limit, but implementers often impose one Names (continued) • Special characters – PHP: all variable names must begin with dollar signs – Perl: all variable names begin with special characters, which specify the variable’s type – Ruby: variable names that begin with @ are instance variables; those that begin with @@ are class variables Names (continued) • Case sensitivity – Disadvantage: readability (names that look alike are different) • Names in the C-based languages are case sensitive • Names in others are not • Worse in C++, Java, and C# because predefined names are mixed case (e.g. IndexOutOfBoundsException ) Names (continued) • Special words – An aid to readability; used to delimit or separate statement clauses • A keyword is a word that is special only
    [Show full text]