Ada -- What Is A Modular Type -


I am trying to learn ADA, but the records are hard. I am studying on this subject, but all the explanations have become difficult for me to understand. I have often seen such a code

  type Stream_Element mod 2 ** Standard 'storage_anuite;  

What does this do? I got an explanation:

Ada also allows you to define modular types. These types have not been unsigned and "rap-surround" cementix is ​​an exception exceeding a simple type of end, but the end of a modular type increases to zero, in addition, operators are able to manipulate bitrs For modular types, and, or, and excerpts, can not be used. Figure 11 shows.

This explanation is understood, but I do not understand the code. What does the indicator mod 2 ** X ? What is mod for? What does ** do?

** exponentiation operator is this, e ** B means A b .

mod , in this context, only the syntax is to tell that you are defining a modular type In this situation, this means that it is an integer type whose value 0 to 2 standard 'storage_newit' - 1. Definition from Standard'Storage_Unit is not defined by language, but defined by ADA compiler What you are using (define language as language to the compilers allows for); I believe this is equivalent to system.storage_Unit . It is a continuous one that defines the number of bits in an addressed storage unit. This is 8 for the vast majority of large processors (since each address addresses 8-bit bytes), but there are exceptions.

So what it does is define an integer type, which is 0 to 255 (on most processors), i.e. the integer that fit into a byte Since it is "modular", it also means that type size arithmetic operations (such as if you add 130 + 130, you get 4, and Constrain_Error will not be raised). In modular types, the bitvard operator and , or , and xor are set for them.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -