Skip to content

Commit da54107

Browse files
committed
Merge branch 'slides/add_notes_tips_warnings_up_to_basic' into 'master'
Add warnings, tips, notes See merge request feng/training/material!298
2 parents b694085 + a9b5e65 commit da54107

11 files changed

+55
-38
lines changed

courses/fundamentals_of_ada/020_declarations/01-introduction.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,14 @@ Declarations
3636
- et cetera
3737

3838
* In a :dfn:`declarative part`
39+
3940
* Example: :ada:`N : Type := Value;`
4041

4142
- ``N`` is usually an :dfn:`identifier`
4243

43-
* Declaration **must precede** use
4444
* **Some** implicit declarations
4545

4646
- **Standard** types and operations
4747
- **Implementation**-defined
4848

49+
.. warning:: Declaration **must precede** use

courses/fundamentals_of_ada/020_declarations/02-identifiers_and_comments.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ Identifiers
3131
A_
3232
_space_person
3333
34+
.. warning:: Reserved words are **forbidden**
35+
3436
* Character set **Unicode** 4.0
3537
* Case **not significant**
3638

3739
- `SpacePerson` |equivalent| `SPACEPERSON`
3840
- ...but **different** from `Space_Person`
3941

40-
* Reserved words are **forbidden**
41-
4242
----------------
4343
Reserved Words
4444
----------------

courses/fundamentals_of_ada/020_declarations/03-literals.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ Decimal Numeric Literals
3434
numeral [.numeral] E [+numeral|-numeral]
3535
numeral ::= digit {['_'] digit}
3636
37-
* Underscore is not significant
37+
.. tip:: Underscore is **not** significant and helpful for grouping
38+
3839
* **E** (exponent) must always be integer
3940
* Examples
4041

courses/fundamentals_of_ada/020_declarations/05-universal_types.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ Numeric Literals Are Universally Typed
3434

3535
* Compiler handles typing
3636

37-
- No bugs with precision
37+
.. note:: No bugs with precision
3838

39-
.. code:: Ada
39+
.. code:: Ada
4040
41-
X : Unsigned_Long := 0;
42-
Y : Unsigned_Short := 0;
41+
X : Unsigned_Long := 0;
42+
Y : Unsigned_Short := 0;
4343
4444
----------------------------------------
4545
Literals Must Match "Class" of Context

courses/fundamentals_of_ada/020_declarations/06-named_numbers.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,13 @@ Named Number Benefit
5151
* Evaluation at **compile time**
5252

5353
- As if **used directly** in the code
54-
- **Perfect** accuracy
5554

56-
.. code:: Ada
55+
.. tip:: Useful due to their **perfect** accuracy
5756

58-
Named_Number : constant := 1.0 / 3.0;
59-
Typed_Constant : constant Float := 1.0 / 3.0;
57+
.. code:: Ada
58+
59+
Named_Number : constant := 1.0 / 3.0;
60+
Typed_Constant : constant Float := 1.0 / 3.0;
6061
6162
.. container:: latex_environment footnotesize
6263

courses/fundamentals_of_ada/020_declarations/07-scope_and_visibility.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,8 @@ Scope and "Lifetime"
6161
----------------------
6262

6363
* Object in scope |rightarrow| exists
64-
* No *scoping* keywords
6564

66-
- C's :c:`static`, :c:`auto` etc...
65+
.. note:: No *scoping* keywords (C's :c:`static`, :c:`auto` etc...)
6766

6867
.. image:: block_scope_example.jpeg
6968
:height: 50%
@@ -101,9 +100,11 @@ Overcoming Hiding
101100

102101
- Needs named scope
103102

104-
* Homographs are a *code smell*
103+
.. warning::
105104

106-
- May need **refactoring**...
105+
* Homographs are a *code smell*
106+
107+
- May need **refactoring**...
107108

108109
.. code:: Ada
109110

courses/fundamentals_of_ada/030_basic_types/01-introduction.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ Strong Typing
1515

1616
- **Check** of values and operations
1717
- Easy for a computer
18-
- Developer can focus on **earlier** phase: requirement
18+
19+
.. tip:: Developer can focus on **earlier** phase: requirement
1920

2021
----------------------------------------
2122
Strongly-Typed Vs Weakly-Typed Languages
@@ -198,7 +199,8 @@ Type Model Run-Time Costs
198199
* **Same performance** for identical programs
199200

200201
- Run-time type checks can be disabled
201-
- Compile-time check is *free*
202+
203+
.. note:: Compile-time check is *free*
202204

203205
.. container:: columns
204206

courses/fundamentals_of_ada/030_basic_types/02-discrete_numeric_types.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ Predefined Signed Integer Types
5151
- Guaranteed ranges: :ada:`Short_Integer` ``<=`` :ada:`Integer` ``<=`` :ada:`Long_Integer`
5252
- Ranges are all **implementation-defined**
5353

54-
* Portability not guaranteed
54+
.. warning::
5555

56-
- But may be difficult to avoid
56+
Portability not guaranteed
57+
58+
* But usage may be difficult to avoid
5759

5860
---------------------------------
5961
Operators for Signed Integer Type
@@ -67,12 +69,13 @@ Operators for Signed Integer Type
6769
:multiplying operator: :ada:`* | / | mod | rem`
6870
:highest precedence operator: :ada:`** | abs`
6971

70-
* *Note*: for exponentiation :ada:`**`
72+
.. note::
7173

72-
- Result will be a signed integer
73-
- So power **must** be :ada:`Integer` ``>= 0``
74+
Exponentiation (:ada:`**`) result will be a signed integer
7475

75-
* Division by zero |rightarrow| :ada:`Constraint_Error`
76+
- So power **must** be :ada:`Integer` ``>= 0``
77+
78+
.. warning:: Division by zero |rightarrow| :ada:`Constraint_Error`
7679

7780
------------------------
7881
Signed Integer Overflows

courses/fundamentals_of_ada/030_basic_types/02-discrete_numeric_types_with_mod.rst

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ Predefined Signed Integer Types
5151
- Guaranteed ranges: :ada:`Short_Integer` ``<=`` :ada:`Integer` ``<=`` :ada:`Long_Integer`
5252
- Ranges are all **implementation-defined**
5353

54-
* Portability not guaranteed
54+
.. warning::
5555

56-
- But may be difficult to avoid
56+
Portability not guaranteed
57+
58+
- But usage may be difficult to avoid
5759

5860
---------------------------------
5961
Operators for Signed Integer Type
@@ -67,12 +69,13 @@ Operators for Signed Integer Type
6769
:multiplying operator: :ada:`* | / | mod | rem`
6870
:highest precedence operator: :ada:`** | abs`
6971

70-
* *Note*: for exponentiation :ada:`**`
72+
.. note::
73+
74+
Exponentiation (:ada:`**`) result will be a signed integer
7175

72-
- Result will be a signed integer
73-
- So power **must** be :ada:`Integer` ``>= 0``
76+
- So power **must** be :ada:`Integer` ``>= 0``
7477

75-
* Division by zero |rightarrow| :ada:`Constraint_Error`
78+
.. warning:: Division by zero |rightarrow| :ada:`Constraint_Error`
7679

7780
------------------------
7881
Signed Integer Overflows
@@ -119,7 +122,7 @@ Modular Types
119122
* **Unsigned** values
120123
* Adds operations and attributes
121124

122-
* Typically **bit-wise** manipulation
125+
.. note:: Typically **bit-wise** manipulation
123126

124127
* Syntax
125128

courses/fundamentals_of_ada/030_basic_types/07-real_types.rst

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,12 @@ Predefined Floating Point Types
7777
- :ada:`Long_Float` ``>= 11`` digits
7878

7979
* General-purpose
80-
* Best to **avoid** predefined types
8180

82-
- Loss of **portability**
83-
- Easy to avoid
81+
.. tip::
82+
83+
It is best, and easy, to **avoid** predefined types
84+
85+
- To keep **portability**
8486

8587
-------------------------------
8688
Floating Point Type Operators
@@ -94,9 +96,11 @@ Floating Point Type Operators
9496
:multiplying operator: :ada:`* | /`
9597
:highest precedence operator: :ada:`** | abs`
9698

97-
* *Note* on floating-point exponentiation ``**``
99+
.. note::
98100

99-
- Power must be :ada:`Integer`
101+
Exponentiation (:ada:`**`) result will be real
102+
103+
- So power must be :ada:`Integer`
100104

101105
+ Not possible to ask for root
102106
+ :ada:`X**0.5` |rightarrow| :ada:`sqrt (x)`
@@ -140,7 +144,8 @@ Numeric Types Conversion
140144
* Special rule: can always convert between numeric types
141145

142146
- Explicitly
143-
- :ada:`Float` |rightarrow| :ada:`Integer` causes **rounding**
147+
148+
.. warning:: :ada:`Float` |rightarrow| :ada:`Integer` causes **rounding**
144149

145150
.. code:: Ada
146151

0 commit comments

Comments
 (0)