-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcpp.mm
15540 lines (13764 loc) · 544 KB
/
cpp.mm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<map version="freeplane 1.6.0">
<!--To view this file, download free mind mapping software Freeplane from http://freeplane.sourceforge.net -->
<node TEXT="C++" STYLE_REF="Beschreibung" FOLDED="false" ID="ID_1723255651" CREATED="1283093380553" MODIFIED="1514394356050"><hook NAME="MapStyle" background="#fcfce9" zoom="1.5">
<properties show_icon_for_attributes="true" fit_to_viewport="false;"/>
<map_styles>
<stylenode LOCALIZED_TEXT="styles.root_node" STYLE="oval" UNIFORM_SHAPE="true" VGAP_QUANTITY="24.0 pt">
<font SIZE="24"/>
<stylenode LOCALIZED_TEXT="styles.predefined" POSITION="right" STYLE="bubble">
<stylenode LOCALIZED_TEXT="default" MAX_WIDTH="600.0 px" STYLE="as_parent">
<font NAME="SansSerif" SIZE="10" BOLD="false" ITALIC="false"/>
</stylenode>
<stylenode LOCALIZED_TEXT="defaultstyle.details"/>
<stylenode LOCALIZED_TEXT="defaultstyle.attributes">
<font SIZE="9"/>
</stylenode>
<stylenode LOCALIZED_TEXT="defaultstyle.note"/>
<stylenode LOCALIZED_TEXT="defaultstyle.floating">
<edge STYLE="hide_edge"/>
<cloud COLOR="#f0f0f0" SHAPE="ROUND_RECT"/>
</stylenode>
</stylenode>
<stylenode LOCALIZED_TEXT="styles.user-defined" POSITION="right" STYLE="bubble">
<stylenode LOCALIZED_TEXT="styles.topic" COLOR="#18898b" STYLE="fork">
<font NAME="Liberation Sans" SIZE="10" BOLD="true"/>
</stylenode>
<stylenode LOCALIZED_TEXT="styles.subtopic" COLOR="#cc3300" STYLE="fork">
<font NAME="Liberation Sans" SIZE="10" BOLD="true"/>
</stylenode>
<stylenode LOCALIZED_TEXT="styles.subsubtopic" COLOR="#669900">
<font NAME="Liberation Sans" SIZE="10" BOLD="true"/>
</stylenode>
<stylenode LOCALIZED_TEXT="styles.important">
<icon BUILTIN="yes"/>
</stylenode>
<stylenode TEXT="Stichpunkt" COLOR="#000000" STYLE="fork" MAX_WIDTH="300.0 px">
<font NAME="Liberation Sans" SIZE="8" BOLD="true"/>
<richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> </i></font>
</p>
</body>
</html>
</richcontent>
</stylenode>
<stylenode TEXT="Beschreibung" COLOR="#666666" STYLE="fork" MAX_WIDTH="300.0 px">
<font NAME="Liberation Sans" SIZE="8" BOLD="false" ITALIC="true"/>
<richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> </i></font>
</p>
</body>
</html>
</richcontent>
</stylenode>
</stylenode>
<stylenode LOCALIZED_TEXT="styles.AutomaticLayout" POSITION="right" STYLE="bubble">
<stylenode LOCALIZED_TEXT="AutomaticLayout.level.root" COLOR="#000000">
<font SIZE="18"/>
</stylenode>
<stylenode LOCALIZED_TEXT="AutomaticLayout.level,1" COLOR="#ff3333" STYLE="fork" MAX_WIDTH="300.0 px">
<font NAME="Liberation Sans" SIZE="8" BOLD="false" ITALIC="true"/>
</stylenode>
<stylenode LOCALIZED_TEXT="AutomaticLayout.level,2" COLOR="#ff9999" STYLE="fork" MAX_WIDTH="300.0 px">
<font NAME="Liberation Sans" SIZE="8" BOLD="false" ITALIC="true"/>
</stylenode>
<stylenode LOCALIZED_TEXT="AutomaticLayout.level,3" COLOR="#0000ff" STYLE="fork" MAX_WIDTH="300.0 px">
<font NAME="Liberation Sans" SIZE="8" BOLD="false" ITALIC="true"/>
</stylenode>
<stylenode LOCALIZED_TEXT="AutomaticLayout.level,4" COLOR="#ccccff" STYLE="fork" MAX_WIDTH="300.0 px">
<font NAME="Liberation Sans" SIZE="8" BOLD="false" ITALIC="true"/>
</stylenode>
</stylenode>
</stylenode>
</map_styles>
</hook>
<node TEXT="basic" STYLE_REF="Beschreibung" POSITION="right" ID="ID_1479062675" CREATED="1514743378702" MODIFIED="1515405885544">
<hook NAME="AlwaysUnfoldedNode"/>
<node TEXT="binding" STYLE_REF="Stichpunkt" FOLDED="true" ID="ID_1894797471" CREATED="1515338414625" MODIFIED="1515405887794">
<node TEXT="early binding" STYLE_REF="Beschreibung" ID="ID_1219798587" CREATED="1515338418374" MODIFIED="1515338428527"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> Direct function calls can be resolved using a process known as early binding. Early binding (also called static binding) means the compiler (or linker) is able to directly associate the identifier name (such as a function or variable name) with a machine address. Remember that all functions have a unique address. So when the compiler (or linker) encounters a function call, it replaces the function call with a machine language instruction that tells the CPU to jump to the address of the function.</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="late binding" STYLE_REF="Beschreibung" ID="ID_1712646886" CREATED="1515338474687" MODIFIED="1529672102252"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i>In some programs, it is not possible to know which function will be called until runtime (when the program is run). This is known as late binding (or dynamic binding). In C++, one way to get late binding is to use function pointers. To review function pointers briefly, a function pointer is a type of pointer that points to a function instead of a variable. The function that a function pointer points to can be called by using the function call operator (()) on the pointer.</i></font>
</p>
</body>
</html>
</richcontent>
<hook NAME="AlwaysUnfoldedNode"/>
<node TEXT="slightly less efficient" STYLE_REF="Beschreibung" ID="ID_307938318" CREATED="1515338613167" MODIFIED="1515405953640"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> Late binding is slightly less efficient since it involves an extra level of indirection. With early binding, the CPU can jump directly to the function’s address. With late binding, the program has to read the address held in the pointer and then jump to that address. This involves one extra step, making it slightly slower. However, the advantage of late binding is that it is more flexible than early binding, because decisions about what function to call do not need to be made until run time.</i></font>
</p>
</body>
</html>
</richcontent>
<hook NAME="AlwaysUnfoldedNode"/>
<node TEXT="reason" STYLE_REF="Beschreibung" ID="ID_637100764" CREATED="1515339066018" MODIFIED="1515339074536"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> Calling a virtual function is slower than calling a non-virtual function for a couple of reasons: First, we have to use the *__vptr to get to the appropriate virtual table. Second, we have to index the virtual table to find the correct function to call. Only then can we call the function. As a result, we have to do 3 operations to find the function to call, as opposed to 2 operations for a normal indirect function call, or one operation for a direct function call. However, with modern computers, this added time is usually fairly insignificant.</i></font>
</p>
</body>
</html>
</richcontent>
</node>
</node>
<node TEXT="virtual table" STYLE_REF="Beschreibung" ID="ID_450445542" CREATED="1515338796701" MODIFIED="1515405956673"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> To implement virtual functions, C++ uses a special form of late binding known as the virtual table. The virtual table is a lookup table of functions used to resolve function calls in a dynamic/late binding manner. The virtual table sometimes goes by other names, such as “vtable”, “virtual function table”, “virtual method table”, or “dispatch table”.</i></font>
</p>
</body>
</html>
</richcontent>
<hook NAME="AlwaysUnfoldedNode"/>
<node TEXT="each class has its own virtual table" STYLE_REF="Beschreibung" ID="ID_556878778" CREATED="1515338851679" MODIFIED="1515338879197"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> First, every class that uses virtual functions (or is derived from a class that uses virtual functions) is given its own virtual table. This table is simply a static array that the compiler sets up at compile time. A virtual table contains one entry for each virtual function that can be called by objects of the class. Each entry in this table is simply a function pointer that points to the most-derived function accessible by that class.</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="hidden pointer to the base class" STYLE_REF="Beschreibung" ID="ID_1269764330" CREATED="1515338949541" MODIFIED="1515338956717"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> Second, the compiler also adds a hidden pointer to the base class, which we will call *__vptr. *__vptr is set (automatically) when a class instance is created so that it points to the virtual table for that class. Unlike the *this pointer, which is actually a function parameter used by the compiler to resolve self-references, *__vptr is a real pointer. Consequently, it makes each class object allocated bigger by the size of one pointer. It also means that *__vptr is inherited by derived classes, which is important.</i></font>
</p>
</body>
</html>
</richcontent>
</node>
</node>
</node>
</node>
<node TEXT="memory" STYLE_REF="Stichpunkt" FOLDED="true" ID="ID_1671435209" CREATED="1514743388641" MODIFIED="1515405886321">
<node TEXT="The code segment (also called a text segment)," STYLE_REF="Beschreibung" ID="ID_1546558380" CREATED="1514743394822" MODIFIED="1514743435900"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> where the compiled program sits in memory. The code segment is typically read-only.</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="The bss segment (also called the uninitialized data segment)," STYLE_REF="Beschreibung" ID="ID_1309884395" CREATED="1514743413468" MODIFIED="1514743455380"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> where zero-initialized global and static variables are stored.</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="The data segment (also called the initialized data segment)," STYLE_REF="Beschreibung" ID="ID_1820555518" CREATED="1514743467199" MODIFIED="1514743492840"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> where initialized global and static variables are stored.</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="The heap," STYLE_REF="Stichpunkt" FOLDED="true" ID="ID_201521797" CREATED="1514743503302" MODIFIED="1515405894580"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> where dynamically allocated variables are allocated from.</i></font>
</p>
</body>
</html>
</richcontent>
<node TEXT="new operator" STYLE_REF="Beschreibung" ID="ID_249303199" CREATED="1514743762379" MODIFIED="1514743812525"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> In C++, when you use the new operator to allocate memory, this memory is allocated in the application’s heap segment. The address of this memory is passed back by operator new, and can then be stored in a pointer. You do not have to worry about the mechanics behind the process of how free memory is located and allocated to the user.</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="sequential memory requests" STYLE_REF="Beschreibung" ID="ID_657613133" CREATED="1514743852660" MODIFIED="1514743861458"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> However, it is worth knowing that sequential memory requests may not result in sequential memory addresses being allocated!</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="pros/cons" STYLE_REF="Beschreibung" ID="ID_750800936" CREATED="1514743924240" MODIFIED="1515405905222">
<hook NAME="AlwaysUnfoldedNode"/>
<node TEXT="Allocating memory on the heap is comparatively slow." STYLE_REF="Beschreibung" ID="ID_1073727629" CREATED="1514743930993" MODIFIED="1514743932380"/>
<node TEXT="Allocated memory stays allocated until it is specifically deallocated (beware memory leaks) or the application ends (at which point the OS should clean it up)." STYLE_REF="Beschreibung" ID="ID_1481372915" CREATED="1514743971632" MODIFIED="1514743972751"/>
<node TEXT="Dynamically allocated memory must be accessed through a pointer. Dereferencing a pointer is slower than accessing a variable directly." STYLE_REF="Beschreibung" ID="ID_1811286857" CREATED="1514743981567" MODIFIED="1514744075268"/>
<node TEXT="Because the heap is a big pool of memory, large arrays, structures, or classes can be allocated here." STYLE_REF="Beschreibung" ID="ID_251331637" CREATED="1514743992235" MODIFIED="1514744092069"/>
</node>
</node>
<node TEXT="The call stack," STYLE_REF="Stichpunkt" FOLDED="true" ID="ID_1243832337" CREATED="1514743522033" MODIFIED="1515405894932"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> where function parameters, local variables, and other function-related information are stored.</i></font>
</p>
</body>
</html>
</richcontent>
<node TEXT="task" STYLE_REF="Beschreibung" ID="ID_854513865" CREATED="1514744134214" MODIFIED="1514744140974"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> The call stack keeps track of all the active functions (those that have been called but have not yet terminated) from the start of the program to the current point of execution, and handles allocation of all function parameters and local variables.</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="LIFO" STYLE_REF="Beschreibung" ID="ID_897630778" CREATED="1514744232790" MODIFIED="1514744236742"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> A stack is a last-in, first-out (LIFO) structure.</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="in action" STYLE_REF="Beschreibung" ID="ID_1501609422" CREATED="1514744371251" MODIFIED="1515405916179">
<hook NAME="AlwaysUnfoldedNode"/>
<node TEXT="function call" STYLE_REF="Beschreibung" ID="ID_1485217947" CREATED="1514744375991" MODIFIED="1515405919680">
<hook NAME="AlwaysUnfoldedNode"/>
<node TEXT="The program encounters a function call." STYLE_REF="Beschreibung" ID="ID_425428816" CREATED="1514744419428" MODIFIED="1514744420465"/>
<node TEXT="A stack frame is constructed and pushed on the stack." STYLE_REF="Beschreibung" ID="ID_320648547" CREATED="1514744430681" MODIFIED="1515405925513">
<hook NAME="AlwaysUnfoldedNode"/>
<node TEXT="return address" STYLE_REF="Beschreibung" ID="ID_615792148" CREATED="1514744435283" MODIFIED="1514744438872"/>
<node TEXT="function arguments" STYLE_REF="Beschreibung" ID="ID_504837294" CREATED="1514744439373" MODIFIED="1514744447824"/>
<node TEXT="memory for any local variables" STYLE_REF="Beschreibung" ID="ID_1956938881" CREATED="1514744454091" MODIFIED="1514744459874"/>
<node TEXT="Saved copies of any registers modified by the function that need to be restored when the function returns" STYLE_REF="Beschreibung" ID="ID_187366599" CREATED="1514744476938" MODIFIED="1514744479415"/>
</node>
<node TEXT="The CPU jumps to the function’s start point." STYLE_REF="Beschreibung" ID="ID_704977421" CREATED="1514744486857" MODIFIED="1514744487936"/>
<node TEXT="The instructions inside of the function begin executing." STYLE_REF="Beschreibung" ID="ID_25780619" CREATED="1514744493607" MODIFIED="1514744494624"/>
</node>
<node TEXT="function terminates" STYLE_REF="Beschreibung" ID="ID_334887727" CREATED="1514744503724" MODIFIED="1515405922284">
<hook NAME="AlwaysUnfoldedNode"/>
<node TEXT="Registers are restored from the call stack" STYLE_REF="Beschreibung" ID="ID_1862693909" CREATED="1514744514352" MODIFIED="1514744515404"/>
<node TEXT="The stack frame is popped off the stack. This frees the memory for all local variables and arguments." STYLE_REF="Beschreibung" ID="ID_925431166" CREATED="1514744525926" MODIFIED="1514744526896"/>
<node TEXT="The return value is handled." STYLE_REF="Beschreibung" ID="ID_848752504" CREATED="1514744532168" MODIFIED="1514744533030"/>
<node TEXT="The CPU resumes execution at the return address." STYLE_REF="Beschreibung" ID="ID_795314744" CREATED="1514744538912" MODIFIED="1514744539703"/>
</node>
</node>
<node TEXT="stack overflow" STYLE_REF="Beschreibung" ID="ID_459526545" CREATED="1514744592105" MODIFIED="1515405929966"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> Stack overflow happens when all the memory in the stack has been allocated -- in that case, further allocations begin overflowing into other sections of memory.</i></font>
</p>
</body>
</html>
</richcontent>
<hook NAME="AlwaysUnfoldedNode"/>
<node TEXT="Stack overflow is generally the result of allocating too many variables on the stack, and/or making too many nested function calls (where function A calls function B calls function C calls function D etc…) Overflowing the stack will generally cause a program to crash." STYLE_REF="Beschreibung" ID="ID_1084883438" CREATED="1514744631306" MODIFIED="1514744632360"/>
</node>
<node TEXT="pros/cons" STYLE_REF="Beschreibung" ID="ID_1011186247" CREATED="1514744645926" MODIFIED="1515405932992">
<hook NAME="AlwaysUnfoldedNode"/>
<node TEXT="Allocating memory on the stack is comparatively fast." STYLE_REF="Beschreibung" ID="ID_1678313748" CREATED="1514744651594" MODIFIED="1514744652902"/>
<node TEXT="Memory allocated on the stack stays in scope as long as it is on the stack. It is destroyed when it is popped off the stack." STYLE_REF="Beschreibung" ID="ID_1075014286" CREATED="1514744660246" MODIFIED="1514744661085"/>
<node TEXT="All memory allocated on the stack is known at compile time. Consequently, this memory can be accessed directly through a variable." STYLE_REF="Beschreibung" ID="ID_1436239426" CREATED="1514744677604" MODIFIED="1514744678682"/>
<node TEXT="Because the stack is relatively small, it is generally not a good idea to do anything that eats up lots of stack space. This includes passing by value or creating local variables of large arrays or other memory-intensive structures." STYLE_REF="Beschreibung" ID="ID_990944554" CREATED="1514744687056" MODIFIED="1514744688155"/>
</node>
</node>
</node>
</node>
<node TEXT="elements" STYLE_REF="Beschreibung" POSITION="right" ID="ID_738190097" CREATED="1514396863423" MODIFIED="1515256303528">
<hook NAME="AlwaysUnfoldedNode"/>
<node TEXT="datatypes" STYLE_REF="Stichpunkt" FOLDED="true" ID="ID_55284723" CREATED="1514469270437" MODIFIED="1515253770191">
<node TEXT="built-in types" STYLE_REF="Stichpunkt" FOLDED="true" ID="ID_1908985688" CREATED="1514406070387" MODIFIED="1515254339614">
<node TEXT="boolean" STYLE_REF="Beschreibung" ID="ID_1212452457" CREATED="1514406087988" MODIFIED="1514410653868">
<hook NAME="AlwaysUnfoldedNode"/>
<node TEXT="bool" STYLE_REF="Stichpunkt" FOLDED="true" ID="ID_720054624" CREATED="1514406101619" MODIFIED="1515254356945"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> 1 byte</i></font>
</p>
</body>
</html>
</richcontent>
<node TEXT="1 byte, because this is the smallest addressable memory" STYLE_REF="Beschreibung" ID="ID_301883499" CREATED="1514407658121" MODIFIED="1514407702588"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> boolean values "waste" 7 bits</i></font>
</p>
</body>
</html>
</richcontent>
</node>
</node>
</node>
<node TEXT="character" STYLE_REF="Beschreibung" ID="ID_1136214390" CREATED="1514406111768" MODIFIED="1514410658295">
<hook NAME="AlwaysUnfoldedNode"/>
<node TEXT="char" STYLE_REF="Stichpunkt" ID="ID_1107899458" CREATED="1514406121321" MODIFIED="1515254357531"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> 1 byte</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="wchar_t" STYLE_REF="Stichpunkt" ID="ID_1703589970" CREATED="1514406137173" MODIFIED="1515254357796"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> 1 byte</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="char16_t" STYLE_REF="Stichpunkt" ID="ID_1059481911" CREATED="1514406148426" MODIFIED="1515254358114"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> 2 bytes</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="char32_t" STYLE_REF="Stichpunkt" ID="ID_432961993" CREATED="1514406162055" MODIFIED="1515254358390"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> 4 bytes</i></font>
</p>
</body>
</html>
</richcontent>
</node>
</node>
<node TEXT="integer" STYLE_REF="Beschreibung" ID="ID_919597594" CREATED="1514406174740" MODIFIED="1514410662090"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> careful with integer division</i></font>
</p>
</body>
</html>
</richcontent>
<hook NAME="AlwaysUnfoldedNode"/>
<node TEXT="char" STYLE_REF="Stichpunkt" FOLDED="true" ID="ID_1937093374" CREATED="1514406121321" MODIFIED="1515254359239"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> 1 byte</i></font>
</p>
</body>
</html>
</richcontent>
<node TEXT="signed" STYLE_REF="Beschreibung" ID="ID_1092073893" CREATED="1514406917762" MODIFIED="1514406935031"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> -128 to 127</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="unsigned" STYLE_REF="Beschreibung" ID="ID_541857541" CREATED="1514406936191" MODIFIED="1514406944156"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> 0 to 255</i></font>
</p>
</body>
</html>
</richcontent>
</node>
</node>
<node TEXT="short" STYLE_REF="Stichpunkt" FOLDED="true" ID="ID_1771607513" CREATED="1514406181139" MODIFIED="1515254359587"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> 2 bytes</i></font>
</p>
</body>
</html>
</richcontent>
<node TEXT="signed" STYLE_REF="Beschreibung" ID="ID_318421066" CREATED="1514406956964" MODIFIED="1514406977205"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> -32.768 to 32.767</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="unsigned" STYLE_REF="Beschreibung" ID="ID_1140881535" CREATED="1514406978239" MODIFIED="1514407025976"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> 0 to 65.535</i></font>
</p>
</body>
</html>
</richcontent>
</node>
</node>
<node TEXT="int" STYLE_REF="Stichpunkt" FOLDED="true" ID="ID_366578937" CREATED="1514406190645" MODIFIED="1515254359910"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> 2 bytes</i></font>
</p>
</body>
</html>
</richcontent>
<node TEXT="signed" STYLE_REF="Beschreibung" ID="ID_733120258" CREATED="1514406956964" MODIFIED="1514406977205"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> -32.768 to 32.767</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="unsigned" STYLE_REF="Beschreibung" ID="ID_486035205" CREATED="1514406978239" MODIFIED="1514407025976"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> 0 to 65.535</i></font>
</p>
</body>
</html>
</richcontent>
</node>
</node>
<node TEXT="long" STYLE_REF="Stichpunkt" FOLDED="true" ID="ID_1350516423" CREATED="1514406198045" MODIFIED="1515254360242"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> 4 bytes</i></font>
</p>
</body>
</html>
</richcontent>
<node TEXT="signed" STYLE_REF="Beschreibung" ID="ID_1055944932" CREATED="1514407151062" MODIFIED="1514407188035"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> -2,147,483,648 to 2,147,483,647</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="unsigned" STYLE_REF="Beschreibung" ID="ID_1211326345" CREATED="1514407194894" MODIFIED="1514407199786"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> 0 to 4,294,967,295</i></font>
</p>
</body>
</html>
</richcontent>
</node>
</node>
<node TEXT="long long" STYLE_REF="Stichpunkt" FOLDED="true" ID="ID_1140352550" CREATED="1514406207581" MODIFIED="1515254360541"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> 8 bytes</i></font>
</p>
</body>
</html>
</richcontent>
<node TEXT="signed" STYLE_REF="Beschreibung" ID="ID_769099172" CREATED="1514407213093" MODIFIED="1514407220910"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="unsigned" STYLE_REF="Beschreibung" ID="ID_1675464166" CREATED="1514407227455" MODIFIED="1514407240089"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> 0 to 18,446,744,073,709,551,615</i></font>
</p>
</body>
</html>
</richcontent>
</node>
</node>
<node TEXT="fixed width" STYLE_REF="Stichpunkt" FOLDED="true" ID="ID_830020942" CREATED="1514410579293" MODIFIED="1515254360840">
<node TEXT="fixed width integers" STYLE_REF="Beschreibung" ID="ID_1990464981" CREATED="1514406791704" MODIFIED="1514406883099"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> C++ only guarantees that integer variables will have a minimum size -- but they could be larger, depending on the target system. C99 defined a set of fixed-width integers (in the stdint.h header) that are guaranteed to have the same size on any architecture. C++11 also defines two alternative sets of fixed-width integers.</i></font>
</p>
</body>
</html>
</richcontent>
</node>
</node>
</node>
<node TEXT="floating point" STYLE_REF="Beschreibung" ID="ID_519372094" CREATED="1514406218559" MODIFIED="1514410678714"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> scientific notation: 5e-2</i></font>
</p>
</body>
</html>
</richcontent>
<hook NAME="AlwaysUnfoldedNode"/>
<node TEXT="float" STYLE_REF="Stichpunkt" ID="ID_3761487" CREATED="1514406224054" MODIFIED="1515254361187"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> 4 bytes</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="double" STYLE_REF="Stichpunkt" FOLDED="true" ID="ID_539473153" CREATED="1514406232353" MODIFIED="1515254361479"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> 8 bytes</i></font>
</p>
</body>
</html>
</richcontent>
<node TEXT="rule" STYLE_REF="Beschreibung" ID="ID_1961921802" CREATED="1514407397129" MODIFIED="1514407402859"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> Rule: Favor double over float unless space is at a premium, as the lack of precision in a float will often lead to inaccuracies.</i></font>
</p>
</body>
</html>
</richcontent>
</node>
</node>
<node TEXT="long double" STYLE_REF="Stichpunkt" ID="ID_866615578" CREATED="1514406239713" MODIFIED="1515254361770"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> 8 bytes</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="rounding errors" STYLE_REF="Stichpunkt" FOLDED="true" ID="ID_325510562" CREATED="1514407467740" MODIFIED="1515254362069">
<node TEXT="" STYLE_REF="Beschreibung" ID="ID_694316277" CREATED="1514407473930" MODIFIED="1514407510180"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> Floating point numbers often have small rounding errors, even when the number has fewer significant digits than the precision. Many times these go unnoticed because they are so small, and because the numbers are truncated for output. Consequently, comparisons of floating point numbers may not give the expected results. Performing mathematical operations on these values will cause the rounding errors to grow larger.</i></font>
</p>
</body>
</html>
</richcontent>
</node>
</node>
<node TEXT="precision" STYLE_REF="Stichpunkt" FOLDED="true" ID="ID_695986114" CREATED="1514407533905" MODIFIED="1515254362568">
<node TEXT="" STYLE_REF="Beschreibung" ID="ID_668099418" CREATED="1514407540009" MODIFIED="1514407547637"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> Floating point numbers are great for storing very large or very small numbers, including those with fractional components, so long as they have a limited number of significant digits (precision).</i></font>
</p>
</body>
</html>
</richcontent>
</node>
</node>
</node>
</node>
<node TEXT="strings" STYLE_REF="Stichpunkt" FOLDED="true" ID="ID_1523937978" CREATED="1514650684317" MODIFIED="1515254340265">
<node TEXT="std::string" STYLE_REF="Stichpunkt" FOLDED="true" ID="ID_1626388011" CREATED="1514480866811" MODIFIED="1515254406437">
<node TEXT="define variable" STYLE_REF="Beschreibung" ID="ID_112253940" CREATED="1514480894464" MODIFIED="1514480910848"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> #include <string> </i></font>
</p>
<p>
<font color="#666666" size="1"><i>std::string myName;</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="appending strings" STYLE_REF="Beschreibung" ID="ID_946053485" CREATED="1514481391771" MODIFIED="1514481398064"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> You can use operator+ to concatenate two strings together, or operator+= to append one string to another.</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="string length" STYLE_REF="Beschreibung" ID="ID_1802708097" CREATED="1514481437726" MODIFIED="1514481470606"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> string.length()</i></font>
</p>
</body>
</html>
</richcontent>
</node>
</node>
<node TEXT="C-style / null-terminated string" STYLE_REF="Stichpunkt" FOLDED="true" ID="ID_884615995" CREATED="1514650725026" MODIFIED="1515254405896"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> Rule: Use std::string instead of C-style string</i></font>
</p>
</body>
</html>
</richcontent>
<node TEXT="array of characters that uses a null terminator." STYLE_REF="Beschreibung" ID="ID_1659133306" CREATED="1514650794028" MODIFIED="1514650803727"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> char myString[] = "string";</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="std::cin" STYLE_REF="Beschreibung" ID="ID_1208493549" CREATED="1514650938477" MODIFIED="1514650985924"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i>char name[255];</i></font>
</p>
<p>
<font color="#666666" size="1"><i>std::cout << "Enter your name: "; </i></font>
</p>
<p>
<font color="#666666" size="1"><i>std::cin.getline(name, 255);</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="manipulation" STYLE_REF="Beschreibung" ID="ID_785069461" CREATED="1514651055667" MODIFIED="1515254398897">
<hook NAME="AlwaysUnfoldedNode"/>
<node TEXT="strcpy_s()" STYLE_REF="Beschreibung" ID="ID_713537864" CREATED="1514651059955" MODIFIED="1514651129843"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i>  allows you to copy a string to another string. More commonly, this is used to assign a value to a string:</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="overflow" STYLE_REF="Beschreibung" ID="ID_1976681448" CREATED="1514651087886" MODIFIED="1514651092348"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> can easily cause array overflows if you’re not careful!</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="strlen()" STYLE_REF="Beschreibung" ID="ID_928637191" CREATED="1514651142456" MODIFIED="1514651146599"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> returns the length of the C-style string (without the null terminator).</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="strcat()" STYLE_REF="Beschreibung" ID="ID_1345236968" CREATED="1514651161564" MODIFIED="1514651166250"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> Appends one string to another (dangerous)</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="strncat()" STYLE_REF="Beschreibung" ID="ID_359918599" CREATED="1514651175732" MODIFIED="1514651182064"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> Appends one string to another (with buffer length check)</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="strcmp()" STYLE_REF="Beschreibung" ID="ID_1485701349" CREATED="1514651189985" MODIFIED="1514651194895"><richcontent TYPE="DETAILS">
<html>
<head>
</head>
<body>
<p>
<font color="#666666" size="1"><i> Compare two strings (returns 0 if equal)</i></font>
</p>
</body>
</html>
</richcontent>
</node>
<node TEXT="strncmp()" STYLE_REF="Beschreibung" ID="ID_803753841" CREATED="1514651204333" MODIFIED="1514651209351"><richcontent TYPE="DETAILS">
<html>
<head>