Write Great Code Thinking Low Level Writing High Level 1st Edition Randall Hydeinstant download
Write Great Code Thinking Low Level Writing High Level 1st Edition Randall Hydeinstant download
or textbooks at https://ebookultra.com
_____ Follow the link below to get your download now _____
https://ebookultra.com/download/write-great-code-thinking-
low-level-writing-high-level-1st-edition-randall-hyde/
https://ebookultra.com/download/advanced-screenwriting-taking-your-
writing-to-the-academy-award-level-1st-edition-seger/
https://ebookultra.com/download/the-college-writer-a-guide-to-
thinking-writing-and-researching-fourth-edition-randall-vandermey/
https://ebookultra.com/download/inquiry-based-learning-designing-
instruction-to-promote-higher-level-thinking-3rd-edition-teresa-
coffman/
https://ebookultra.com/download/aqa-a-level-physics-studentbook-1-aqa-
a-level-science-nick-england/
Risk and Decisions about Disposition of Transuranic and
High Level Radioactive Waste 1st Edition National Research
Council
https://ebookultra.com/download/risk-and-decisions-about-disposition-
of-transuranic-and-high-level-radioactive-waste-1st-edition-national-
research-council/
https://ebookultra.com/download/sea-level-science-understanding-tides-
surges-tsunamis-and-mean-sea-level-changes-david-pugh/
https://ebookultra.com/download/sea-level-rise-bruce-douglas/
https://ebookultra.com/download/how-to-write-great-essays-1st-edition-
learningexpress-editors/
https://ebookultra.com/download/handbook-of-sea-level-research-1st-
edition-horton/
Write Great Code Thinking Low Level Writing High
Level 1st Edition Randall Hyde Digital Instant Download
Author(s): Randall Hyde
ISBN(s): 9781593270650, 1593270658
Edition: 1
File Details: PDF, 4.33 MB
Year: 2006
Language: english
G et b et te r r es u lt s
fr o m yo u r
so u r ce co d e
W R I T E G R E AT
CODE
W RITE GRE AT CODE
V OLU M E 2: THI N KI NG LO W -LE V E L , W RITI NG HI G H-LE V E L
PRAISE FOR WRITE GREAT CODE, VOLUME 1: UNDERSTANDING THE MACHINE • The types of machine code statements that compilers
“If you are programming without benefit of formal train- typically generate for common control structures, so you
ing, or if you lack the aegis of a mentor, Randall Hyde’s can choose the best statements when writing HLL code
Write Great Code series should rouse your interest.”
• Just enough x86 and PowerPC assembly language to
—UnixReview.com
read compiler output
No prior knowledge of • How compilers convert various constant and
assembly language required! variable objects into machine data, and how to use
these objects to write faster and shorter programs
In the beginning, most software was written in assembly,
the CPU’s low-level language, in order to achieve You don’t need to give up the productivity and VOLUME 2: T H I N K I N G LOW-LEVEL ,
acceptable performance on relatively slow hardware. portability of high-level languages in order to produce
Early programmers were sparing in their use of high-level more efficient software. With an understanding of how W R I T I N G HIGH-LEVEL
language code, knowing that a high-level language com- compilers work, you’ll be able to write source code
piler would generate crummy low-level machine code for that they can translate into elegant machine code. That
their software. Today, however, many programmers write understanding starts right here, with Write Great Code:
in high-level languages like C, C++, Pascal, Java, or Thinking Low-Level, Writing High-Level.
BASIC. The result is often sloppy, inefficient code. Write
Great Code, Volume 2 helps you avoid this common About the author
problem and learn to write well-structured code.
Randall Hyde is the author of The Art of Assembly
In this second volume of the Write Great Code series, Language, one of the most highly recommended
you’ll learn: resources on assembly, and Write Great Code, Volume
1 (both No Starch Press). He is also the co-author of
• How to analyze the output of a compiler to verify that
The Waite Group’s MASM 6.0 Bible. He has written
your code does, indeed, generate good machine code
for Dr. Dobb’s Journal and Byte, as well as professional
and academic journals.
HYDE
T H E F I N E ST I N G E E K E N T E RTA I N M E N T ™ 5 449 5
w w w.nostarch.com
Randall Hyde
“I lay flat.”
9 781593 270650 6 89145 70658 1
This book uses RepKover — a durable binding that won’t snap shut.
PRAISE FOR WRITE GREAT CODE, VOLUME 1:
UNDERSTANDING THE MACHINE
“If you are programming without benefit of formal training, or if you lack the
aegis of a mentor, Randall Hyde’s Write Great Code series should rouse your
interest . . . The first five chapters and the Boolean Logic chapter are worth the
price of the book.”
—UNIX REVIEW
“The book explains in detail what most programmers take for granted.”
--COMPUTER SHOPPER (UK)
“Not for the novice, this book details the innermost workings of the machine at a
very complex level. Programmers who are interested in working at that level will
the find the book most helpful.”
—SECURITYITWORLD.COM
“It fills in the blanks nicely and really could be part of a Computer Science
degree required reading set. . . . Once this book is read, you will have a greater
understanding and appreciation for code that is written efficiently—and you may
just know enough to do that yourself."
—MACCOMPANION, AFTER GIVING IT A 5 OUT OF 5 STARS RATING
“Write Great Code: Understanding the Machine should be on the required reading list
for anyone who wants to develop terrific code in any language without having to
learn assembly language.”
—WEBSERVERTALK
“Hyde is taking on a topic that continues to lie at the core of all development, the
foundations of computer architecture.”
—PRACTICAL APPLICATIONS
“Isn’t your typical ‘teach yourself to program’ book. . . . It’s relevant to all
languages, and all levels of programming experience. . . . Run, don’t walk, to buy
and read this book.”
—BAY AREA LARGE INSTALLATION SYSTEM ADMINISTRATORS (BAYLISA)
WRITE GREAT
CODE
V o lu m e 2 : T h i n ki n g L o w -
L e ve l , W r i ti n g H i g h - L eve l
b y R an d a l l H y de
San Francisco
WRITE GREAT CODE, Vol. 2: Thinking Low-Level, Writing High-Level. Copyright © 2006 by Randall Hyde.
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or
mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior
written permission of the copyright owner and the publisher.
1 2 3 4 5 6 7 8 9 10 – 09 08 07 06
No Starch Press and the No Starch Press logo are registered trademarks of No Starch Press, Inc. Other product and
company names mentioned herein may be the trademarks of their respective owners. Rather than use a trademark
symbol with every occurrence of a trademarked name, we are using the names only in an editorial fashion and to the
benefit of the trademark owner, with no intention of infringement of the trademark.
For information on book distributors or translations, please contact No Starch Press, Inc. directly:
The information in this book is distributed on an “As Is” basis, without warranty. While every precaution has been
taken in the preparation of this work, neither the author nor No Starch Press, Inc. 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
information contained in it.
Hyde, Randall.
Write great code : understanding the machine / Randall Hyde.
p. cm.
ISBN 1-59327-003-8
1. Computer programming. 2. Computer architecture. I. Title.
QA76.6.H94 2004
005.1--dc22
2003017502
BRIEF CONTENTS
Acknowledgments ..........................................................................................................xv
Introduction .................................................................................................................xvii
Appendix: A Brief Comparison of the 80x86 and PowerPC CPU Families .........................581
Index .........................................................................................................................591
vi Br ief C on t en ts
CONTENTS IN DETAIL
A CK N O W LE D G M E N T S xv
I NT R O D UC T I O N xvii
1
T H IN K I N G L O W -L E V E L , W R I T I N G H IG H- L E V E L 1
1.1 Misconceptions About Compiler Quality .............................................................. 2
1.2 Why Learning Assembly Language Is Still a Good Idea ......................................... 2
1.3 Why Learning Assembly Language Isn’t Absolutely Necessary................................ 3
1.4 Thinking Low-Level............................................................................................. 3
1.4.1 Compilers Are Only as Good as the Source Code You Feed Them.......... 4
1.4.2 Helping the Compiler Produce Better Machine Code ............................. 4
1.4.3 How to Think in Assembly While Writing HLL Code .............................. 5
1.5 Writing High-Level ............................................................................................ 7
1.6 Assumptions ..................................................................................................... 7
1.7 Language-Neutral Approach .............................................................................. 8
1.8 Characteristics of Great Code ............................................................................ 8
1.9 The Environment for This Text.............................................................................. 9
1.10 For More Information..................................................................................... 10
2
S HO U L D N ’ T YO U LE A R N A SS E M B L Y L AN G U A G E ? 11
2.1 Roadblocks to Learning Assembly Language....................................................... 12
2.2 Write Great Code, Volume 2, to the Rescue ....................................................... 12
2.3 High-Level Assemblers to the Rescue .................................................................. 13
2.4 The High-Level Assembler (HLA) ........................................................................ 14
2.5 Thinking High-Level, Writing Low-Level............................................................... 15
2.6 The Assembly Programming Paradigm (Thinking Low-Level) .................................. 16
2.7 The Art of Assembly Language and Other Resources ........................................... 18
3
8 0X 8 6 A S S E M B L Y F O R T H E HL L P R O G R A M M E R 21
3.1 Learning One Assembly Language Is Good, Learning More Is Better ..................... 22
3.2 80x86 Assembly Syntaxes ............................................................................... 22
3.3 Basic 80x86 Architecture................................................................................. 23
3.3.1 Registers ........................................................................................ 23
3.3.2 80x86 General-Purpose Registers ..................................................... 24
3.3.3 The 80x86 EFLAGS Register............................................................. 25
3.4 Literal Constants.............................................................................................. 26
3.4.1 Binary Literal Constants.................................................................... 26
3.4.2 Decimal Literal Constants ................................................................. 27
3.4.3 Hexadecimal Literal Constants .......................................................... 27
3.4.4 Character and String Literal Constants ............................................... 28
3.4.5 Floating-Point Literal Constants .......................................................... 29
3.5 Manifest (Symbolic) Constants in Assembly Language.......................................... 30
3.5.1 Manifest Constants in HLA ............................................................... 30
3.5.2 Manifest Constants in Gas ............................................................... 30
3.5.3 Manifest Constants in MASM and TASM ........................................... 31
3.6 80x86 Addressing Modes ............................................................................... 31
3.6.1 80x86 Register Addressing Modes ................................................... 31
3.6.2 Immediate Addressing Mode............................................................ 32
3.6.3 Displacement-Only Memory Addressing Mode ................................... 33
3.6.4 Register Indirect Addressing Mode .................................................... 35
3.6.5 Indexed Addressing Mode ............................................................... 36
3.6.6 Scaled-Indexed Addressing Modes.................................................... 38
3.7 Declaring Data in Assembly Language .............................................................. 39
3.7.1 Data Declarations in HLA ................................................................. 40
3.7.2 Data Declarations in MASM and TASM............................................. 41
3.7.3 Data Declarations in Gas ................................................................. 41
3.8 Specifying Operand Sizes in Assembly Language ............................................... 44
3.8.1 Type Coercion in HLA ..................................................................... 44
3.8.2 Type Coercion in MASM and TASM ................................................. 45
3.8.3 Type Coercion in Gas ..................................................................... 45
3.9 The Minimal 80x86 Instruction Set .................................................................... 46
3.10 For More Information..................................................................................... 46
4
P O W E R P C AS S E M B LY FO R T HE H LL PR O G R AM M E R 47
4.1 Learning One Assembly Language Is Good; More Is Better .................................. 48
4.2 Assembly Syntaxes.......................................................................................... 48
4.3 Basic PowerPC Architecture.............................................................................. 49
4.3.1 General-Purpose Integer Registers ..................................................... 49
4.3.2 General-Purpose Floating-Point Registers ............................................ 49
4.3.3 User-Mode-Accessible Special-Purpose Registers ................................. 49
4.4 Literal Constants.............................................................................................. 52
4.4.1 Binary Literal Constants.................................................................... 52
4.4.2 Decimal Literal Constants ................................................................. 53
4.4.3 Hexadecimal Literal Constants .......................................................... 53
4.4.4 Character and String Literal Constants ............................................... 53
4.4.5 Floating-Point Literal Constants .......................................................... 53
4.5 Manifest (Symbolic) Constants in Assembly Language.......................................... 54
4.6 PowerPC Addressing Modes ............................................................................ 54
4.6.1 PowerPC Register Access ................................................................. 54
4.6.2 The Immediate Addressing Mode ...................................................... 54
4.6.3 PowerPC Memory Addressing Modes................................................ 55
4.7 Declaring Data in Assembly Language .............................................................. 56
4.8 Specifying Operand Sizes in Assembly Language ............................................... 59
4.9 The Minimal Instruction Set............................................................................... 59
4.10 For More Information..................................................................................... 59
viii C on t en t s in D et ai l
5
C O M PI L E R O P E R A T I O N A N D CO D E G E N E R A T I O N 61
5.1 File Types That Programming Languages Use...................................................... 62
5.2 Programming Language Source Files ................................................................. 62
5.2.1 Tokenized Source Files .................................................................... 62
5.2.2 Specialized Source File Formats........................................................ 63
5.3 Types of Computer Language Processors............................................................ 63
5.3.1 Pure Interpreters .............................................................................. 64
5.3.2 Interpreters ..................................................................................... 64
5.3.3 Compilers ...................................................................................... 64
5.3.4 Incremental Compilers ..................................................................... 65
5.4 The Translation Process.................................................................................... 66
5.4.1 Lexical Analysis and Tokens ............................................................. 68
5.4.2 Parsing (Syntax Analysis) ................................................................. 69
5.4.3 Intermediate Code Generation.......................................................... 69
5.4.4 Optimization .................................................................................. 70
5.4.5 Comparing Different Compilers’ Optimizations ................................... 81
5.4.6 Native Code Generation ................................................................. 81
5.5 Compiler Output ............................................................................................. 81
5.5.1 Emitting HLL Code as Compiler Output .............................................. 82
5.5.2 Emitting Assembly Language as Compiler Output................................ 83
5.5.3 Emitting Object Files as Compiler Output ........................................... 84
5.5.4 Emitting Executable Files as Compiler Output ..................................... 85
5.6 Object File Formats ......................................................................................... 85
5.6.1 The COFF File Header ..................................................................... 86
5.6.2 The COFF Optional Header ............................................................. 88
5.6.3 COFF Section Headers .................................................................... 91
5.6.4 COFF Sections................................................................................ 93
5.6.5 The Relocation Section..................................................................... 94
5.6.6 Debugging and Symbolic Information................................................ 94
5.6.7 Learning More About Object File Formats .......................................... 94
5.7 Executable File Formats ................................................................................... 94
5.7.1 Pages, Segments, and File Size ........................................................ 95
5.7.2 Internal Fragmentation ..................................................................... 97
5.7.3 So Why Optimize for Space?........................................................... 98
5.8 Data and Code Alignment in an Object File ....................................................... 99
5.8.1 Choosing a Section Alignment Size................................................. 100
5.8.2 Combining Sections ...................................................................... 101
5.8.3 Controlling the Section Alignment ................................................... 102
5.8.4 Section Alignment and Library Modules ........................................... 102
5.9 Linkers and Their Effect on Code ..................................................................... 110
5.10 For More Information................................................................................... 113
6
T O O L S F O R A N A LY Z IN G C O M P IL E R O U T P UT 115
6.1 Background.................................................................................................. 116
6.2 Telling a Compiler to Produce Assembly Output ................................................ 117
6.2.1 Assembly Output from GNU and Borland Compilers ......................... 118
6.2.2 Assembly Output from Visual C++ .................................................. 118
6.2.3 Example Assembly Language Output............................................... 118
6.2.4 Analyzing Assembly Output from a Compiler ................................... 128
C on t en ts in D et ail ix
6.3 Using Object-Code Utilities to Analyze Compiler Output .................................... 129
6.3.1 The Microsoft dumpbin.exe Utility ................................................... 129
6.3.2 The FSF/GNU objdump.exe Utility .................................................. 142
6.4 Using a Disassembler to Analyze Compiler Output............................................ 146
6.5 Using a Debugger to Analyze Compiler Output ................................................ 149
6.5.1 Using an IDE’s Debugger ............................................................... 149
6.5.2 Using a Stand-Alone Debugger....................................................... 151
6.6 Comparing Output from Two Compilations ...................................................... 152
6.6.1 Before-and-After Comparisons with diff ............................................ 153
6.6.2 Manual Comparison ..................................................................... 162
6.7 For More Information..................................................................................... 163
7
C O NS T AN T S A ND H I G H- L E V E L L AN G U A G E S 165
7.1 Literal Constants and Program Efficiency .......................................................... 166
7.2 Literal Constants Versus Manifest Constants ...................................................... 168
7.3 Constant Expressions ..................................................................................... 169
7.4 Manifest Constants Versus Read-Only Memory Objects...................................... 171
7.5 Enumerated Types ......................................................................................... 172
7.6 Boolean Constants ........................................................................................ 174
7.7 Floating-Point Constants ................................................................................. 176
7.8 String Constants............................................................................................ 182
7.9 Composite Data Type Constants ..................................................................... 186
7.10 For More Information................................................................................... 188
8
V AR I AB LE S IN A HI G H -L E V E L L A N G U AG E 189
8.1 Runtime Memory Organization ....................................................................... 190
8.1.1 The Code, Constant, and Read-Only Sections................................... 191
8.1.2 The Static Variables Section ........................................................... 193
8.1.3 The BSS Section............................................................................ 194
8.1.4 The Stack Section.......................................................................... 195
8.1.5 The Heap Section and Dynamic Memory Allocation .......................... 196
8.2 What Is a Variable? ...................................................................................... 196
8.2.1 Attributes ..................................................................................... 197
8.2.2 Binding........................................................................................ 197
8.2.3 Static Objects ............................................................................... 197
8.2.4 Dynamic Objects .......................................................................... 197
8.2.5 Scope.......................................................................................... 198
8.2.6 Lifetime ........................................................................................ 198
8.2.7 So What Is a Variable? ................................................................. 199
8.3 Variable Storage .......................................................................................... 199
8.3.1 Static Binding and Static Variables.................................................. 199
8.3.2 Pseudo-Static Binding and Automatic Variables................................. 203
8.3.3 Dynamic Binding and Dynamic Variables ........................................ 206
8.4 Common Primitive Data Types ........................................................................ 210
8.4.1 Integer Variables .......................................................................... 210
8.4.2 Floating-Point/Real Variables ......................................................... 213
8.4.3 Character Variables ...................................................................... 214
8.4.4 Boolean Variables......................................................................... 215
x C on t en ts in D et ai l
8.5 Variable Addresses and High-level Languages.................................................. 215
8.5.1 Storage Allocation for Global and Static Variables ........................... 216
8.5.2 Using Automatic Variables to Reduce Offset Sizes............................. 217
8.5.3 Storage Allocation for Intermediate Variables ................................... 223
8.5.4 Storage Allocation for Dynamic Variables and Pointers...................... 224
8.5.5 Using Records/Structures to Reduce Instruction Offset Sizes................ 226
8.5.6 Register Variables ......................................................................... 228
8.6 Variable Alignment in Memory ....................................................................... 229
8.6.1 Records and Alignment.................................................................. 235
8.7 For More Information..................................................................................... 239
9
A R R AY D A T A T Y PE S 241
9.1 What Is an Array? ........................................................................................ 242
9.1.1 Array Declarations ........................................................................ 242
9.1.2 Array Representation in Memory..................................................... 246
9.1.3 Accessing Elements of an Array ...................................................... 250
9.1.4 Padding Versus Packing................................................................. 252
9.1.5 Multidimensional Arrays ................................................................ 255
9.1.6 Dynamic Versus Static Arrays ......................................................... 270
9.2 For More Information..................................................................................... 279
10
S T R IN G D A T A T Y PE S 281
10.1 Character String Formats ............................................................................. 282
10.1.1 Zero-Terminated Strings ............................................................... 283
10.1.2 Length-Prefixed Strings ................................................................. 300
10.1.3 7-Bit Strings ................................................................................ 302
10.1.4 HLA Strings ................................................................................ 303
10.1.5 Descriptor-Based Strings .............................................................. 306
10.2 Static, Pseudo-Dynamic, and Dynamic Strings................................................. 307
10.2.1 Static Strings .............................................................................. 308
10.2.2 Pseudo-Dynamic Strings ............................................................... 308
10.2.3 Dynamic Strings.......................................................................... 308
10.3 Reference Counting for Strings...................................................................... 309
10.4 Delphi/Kylix Strings .................................................................................... 310
10.5 Using Strings in a High-Level Language ......................................................... 310
10.6 Character Data in Strings............................................................................. 312
10.7 For More Information................................................................................... 314
11
P O IN T E R D A T A T YP E S 315
11.1 Defining and Demystifying Pointers ............................................................... 316
11.2 Pointer Implementation in High-Level Languages.............................................. 317
11.3 Pointers and Dynamic Memory Allocation ...................................................... 320
11.4 Pointer Operations and Pointer Arithmetic ...................................................... 320
11.4.1 Adding an Integer to a Pointer...................................................... 322
11.4.2 Subtracting an Integer from a Pointer............................................. 323
C on t en ts in D et ail xi
11.4.3 Subtracting a Pointer from a Pointer .............................................. 324
11.4.4 Comparing Pointers..................................................................... 325
11.4.5 Logical AND/OR and Pointers...................................................... 327
11.4.6 Other Operations with Pointers ..................................................... 328
11.5 A Simple Memory Allocator Example ............................................................ 329
11.6 Garbage Collection .................................................................................... 332
11.7 The OS and Memory Allocation.................................................................... 332
11.8 Heap Memory Overhead............................................................................. 333
11.9 Common Pointer Problems............................................................................ 335
11.9.1 Using an Uninitialized Pointer....................................................... 336
11.9.2 Using a Pointer That Contains an Illegal Value................................ 337
11.9.3 Continuing to Use Storage After It Has Been Freed.......................... 337
11.9.4 Failing to Free Storage When Done with It ..................................... 338
11.9.5 Accessing Indirect Data Using the Wrong Data Type....................... 339
11.10 For More Information................................................................................. 340
12
R E C O R D , U NI O N , A N D C L A SS D A T A T Y PE S 341
12.1 Records ..................................................................................................... 342
12.1.1 Record Declarations in Various Languages ..................................... 342
12.1.2 Instantiation of a Record .............................................................. 344
12.1.3 Initialization of Record Data at Compile Time ................................. 350
12.1.4 Memory Storage of Records ......................................................... 355
12.1.5 Using Records to Improve Memory Performance ............................. 358
12.1.6 Dynamic Record Types and Databases .......................................... 359
12.2 Discriminant Unions..................................................................................... 360
12.3 Union Declarations in Various Languages ...................................................... 360
12.3.1 Union Declarations in C/C++....................................................... 361
12.3.2 Union Declarations in Pascal/Delphi/Kylix .................................... 361
12.3.3 Union Declarations in HLA ........................................................... 362
12.4 Memory Storage of Unions .......................................................................... 362
12.5 Other Uses of Unions .................................................................................. 363
12.6 Variant Types ............................................................................................. 364
12.7 Namespaces .............................................................................................. 369
12.8 Classes and Objects.................................................................................... 371
12.8.1 Classes Versus Objects ................................................................ 371
12.8.2 Simple Class Declarations in C++ ................................................. 371
12.8.3 Virtual Method Tables.................................................................. 373
12.8.4 Sharing VMTs............................................................................. 377
12.8.5 Inheritance in Classes .................................................................. 377
12.8.6 Polymorphism in Classes .............................................................. 380
12.8.7 Classes, Objects, and Performance ............................................... 381
12.9 For More Information................................................................................... 382
13
A R I T H M E T I C A N D L O G IC A L E X P R E S S IO NS 385
13.1 Arithmetic Expressions and Computer Architecture .......................................... 386
13.1.1 Stack-Based Machines ................................................................. 386
13.1.2 Accumulator-Based Machines ....................................................... 391
xii C on te nt s i n De ta il
13.1.3 Register-Based Machines.............................................................. 393
13.1.4 Typical Forms of Arithmetic Expressions ......................................... 394
13.1.5 Three-Address Architectures.......................................................... 395
13.1.6 Two-Address Architectures............................................................ 395
13.1.7 Architectural Differences and Your Code........................................ 396
13.1.8 Handling Complex Expressions..................................................... 397
13.2 Optimization of Arithmetic Statements ........................................................... 397
13.2.1 Constant Folding......................................................................... 398
13.2.2 Constant Propagation .................................................................. 399
13.2.3 Dead Code Elimination................................................................ 400
13.2.4 Common Subexpression Elimination .............................................. 402
13.2.5 Strength Reduction ...................................................................... 406
13.2.6 Induction.................................................................................... 410
13.2.7 Loop Invariants ........................................................................... 413
13.2.8 Optimizers and Programmers ....................................................... 416
13.3 Side Effects in Arithmetic Expressions ............................................................ 416
13.4 Containing Side Effects: Sequence Points ....................................................... 421
13.5 Avoiding Problems Caused by Side Effects..................................................... 425
13.6 Forcing a Particular Order of Evaluation ........................................................ 425
13.7 Short-Circuit Evaluation ................................................................................ 427
13.7.1 Short-Circuit Evaluation and Boolean Expressions............................ 428
13.7.2 Forcing Short-Circuit or Complete Boolean Evaluation...................... 430
13.7.3 Efficiency Issues .......................................................................... 432
13.8 The Relative Cost of Arithmetic Operations ..................................................... 436
13.9 For More Information................................................................................... 437
14
C O NT RO L ST RU C T UR E S A N D
P R O G R A M M AT IC D E C IS I O N S 439
14.1 Control Structures Are Slower Than Computations! .......................................... 440
14.2 Introduction to Low-Level Control Structures..................................................... 440
14.3 The goto Statement...................................................................................... 443
14.4 break, continue, next, return, and Other Limited Forms of the goto Statement ..... 447
14.5 The if Statement .......................................................................................... 448
14.5.1 Improving the Efficiency of Certain if/else Statements ...................... 450
14.5.2 Forcing Complete Boolean Evaluation in an if Statement .................. 453
14.5.3 Forcing Short-Circuit Boolean Evaluation in an if Statement .............. 460
14.6 The switch/case Statement ........................................................................... 466
14.6.1 Semantics of a switch/case Statement ........................................... 467
14.6.2 Jump Tables Versus Chained Comparisons ..................................... 468
14.6.3 Other Implementations of switch/case ........................................... 475
14.6.4 Compiler Output for switch Statements........................................... 486
14.7 For More Information................................................................................... 486
15
I T E R A T I V E CO N T R O L S T R U CT UR E S 489
15.1 The while Loop ........................................................................................... 489
15.1.1 Forcing Complete Boolean Evaluation in a while Loop ..................... 492
15.1.2 Forcing Short-Circuit Boolean Evaluation in a while Loop ................. 501
C o nt en t s in D et ai l xiii
Exploring the Variety of Random
Documents with Different Content
The Project Gutenberg eBook of Rund um Süd-
Amerika: Reisebriefe
This ebook is for the use of anyone anywhere in the United States
and most other parts of the world at no cost and with almost no
restrictions whatsoever. You may copy it, give it away or re-use it
under the terms of the Project Gutenberg License included with this
ebook or online at www.gutenberg.org. If you are not located in the
United States, you will have to check the laws of the country where
you are located before using this eBook.
Language: German
RUND UM
S Ü D -A M E R I K A
REISEBRIEFE
VON
DR. OSKAR v. RIESEMANN
MIT 43 ABBILDUNGEN AUF 16 TAFELN
DIETRICH REIMER (ERNST VOHSEN)
BERLIN 1914
A L L E R E C H T E V O R B E H A LT E N
DAS BILD AUF DEM UMSCHLAG STELLT
»FELSBLÖCKE AM TITICACA-SEE« DAR
SR. DURCHLAUCHT
FÜRST PETER LIEVEN
DEM TREUEN REISEGEFÄHRTEN IN
HERZLICHER FREUNDSCHAFT UND DANKBARKEIT
FÜR MANCHE ANREGUNG ZUGEEIGNET
VORWORT.
Die vorliegenden Briefe erschienen während meiner Reise vom
Dezember 1912 bis zum Juli 1913 in der »Moskauer Deutschen
Zeitung«. Auf wissenschaftliche Gründlichkeit, oder Vollständigkeit in
irgend einer Beziehung können sie nicht die geringsten Ansprüche
erheben. Trotzdem habe ich mich entschlossen, sie gesammelt der
Öffentlichkeit zu übergeben.
Die Reiseliteratur über Süd-Amerika ist sehr arm. Bevor ich meine
Reise antrat, habe ich die besten Buchhandlungen in Petersburg,
Berlin und London abgesucht, ohne irgend etwas Brauchbares zu
finden. Infolgedessen hoffe ich, daß selbst diese oberflächlichen
Schilderungen Reisenden, deren Ziel Süd-Amerika ist, nützlich sein
können. Sie enthalten die frischen Eindrücke eines Reisenden,
dessen Amerika-Fahrt keinen anderen Zweck verfolgte, als den: Land
und Leute außerhalb Europas ein wenig kennen zu lernen.
Irgend ein System oder irgend eine Tendenz sucht man in diesen
Blättern vergeblich. Ich bin ein Freund von planlosen Reisen und
hatte das Glück einen gleichgesinnten Reisekameraden zu finden.
Während der Reise wurde das nächste Ziel immer erst beim
Verlassen des vorhergehenden bestimmt. Von Zeit- und
Raumrücksichten waren wir unabhängig. Infolgedessen haben wir
sicherlich vieles Schöne und Naheliegende nicht gesehen, dafür aber
manche vielleicht nicht weniger lohnende Gegenden aufgesucht, an
denen Bädeker-Reisende höchst wahrscheinlich achtlos
vorübergefahren wären. Man betrachte das Büchlein mit Nachsicht.
Es ist von keinem Reise-»professional« geschrieben.
Den Bilderschmuck hätte ich gerne reicher und interessanter
gestaltet, doch bin ich im Photographieren – Dilettant. Einige der
besten Aufnahmen haben mir unsere Reisegefährten in Bolivien,
Herr Werner Schmidt-Valparaiso und Herr Bergassessor Wenker
liebenswürdiger Weise zur Verfügung gestellt. Ich sage ihnen dafür
auch an dieser Stelle meinen aufrichtigen Dank.
Moskau, Dezember 1913.
Dr. O. v. RIESEMANN.
INHALTS-VERZEICHNIS
Vorwort 7
1. Der Steamer »Arlanza«. – Vigo. – Lissabon 11
2. Die Insel Madeira 16
3. Pernambuco. – Bahia 21
4. Rio de Janeiro und brasilianische Karnevalsfreuden 25
5. Buenos Aires 29
6. Die argentinischen Pampas. – Das Weinland von Mendoza 33
7. Die Kordilleren 38
8. Chile. – Allgemeine Eindrücke 43
9. Temuco. – Ein Aufzug der Araucaner-Indianer 49
10. Der Mapuche (Araucaner) chez soi 54
11. Süd-Chile – ein zweites Deutschland 59
12. Chilenisches Gesellschafts-, Bade- und Sportleben 64
13. Von Valparaiso nach Antofogasta. – Die chilenische
Salpeter-Industrie 70
14. Bolivien. – Oruro. – La Paz 76
15. Im tropischen Bolivien 83
1. Von La Paz bis Achecachi 83
2. Von Achecachi nach Sorata 89
3. Von Sorata nach San Carlos 95
4. San Carlos 108
5. Mapiri und Guanay 115
6. Die Rückkehr 128
16. Im Schnellzug durch Peru. – Der Titicaca-See. – Mollendo.
– Lima 135
17. Panama und eine Alligatorjagd 140
18. Von Panama nach New York. – Jamaika. – Cuba 149
19. New York 153
1. Der erste Eindruck 153
2. Hotels, Zeitungswesen, Reklame 159
3. Polizeiwesen, Detektivs, Verbrecherkneipen und
Opiumhöhlen 165
4. Amerikanischer Sport und amerikanische Vergnügungen 175
5. Das Jugendgericht 181
20. Der »Imperator« 187
TAFEL-VERZEICHNIS
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookultra.com