comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Help on record to a Newbie
Date: Sun, 30 Dec 2012 18:03:07 +0200
Date: 2012-12-30T18:03:07+02:00	[thread overview]
Message-ID: <akb6trF3lhjU1@mid.individual.net> (raw)
In-Reply-To: <f06526ef-c173-4569-b918-71f8a8614893@googlegroups.com>

On 12-12-28 13:52 , Cedric wrote:

> I hope that my questions do not rise a flame war. I think everyone
> should write his/her programs as they like.

Sure. Except if they are part of a programming team that must share code.

The point of that discussion was, IMO, to show you that perhaps you
don't need to use a prefix in Ada, just to separate names in one module
from names in other modules (as you often must do in C, for example).

> The comments with "register" in it were meant to define variables
> that can access processor registers. As I learnt last night, this is
> normally not needed when using Ada.

I would still be interested to know what you want to do, that requires
access to processor registers in some other language.

Of course, in assembly language one uses registers all the time, but one
of the points of higher languages is to avoid that.

In some processors, one accesses "special function registers" or "device
registers" to do input/output on a HW level. To a program, such
registers are just memory locations (addresses) with some special
semantics attached. In Ada, as in other languages, one only needs to
tell the compiler or linker to use a certain memory address for a
certain variable, and then mark that variable as "volatile" to make sure
that the compiled code actually accesses memory. (Sometimes it is
necessary to worry about the "width" of the memory access, too, but then
it usually best to fall back to assembly language for these small parts
of the program.)

> I try to find a solution with the Ada way.

If you tell us what you want to do, we can help you find an Ada solution.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
      .      @       .



      parent reply	other threads:[~2012-12-30 16:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-27 19:31 Help on record to a Newbie Cedric
2012-12-27 19:50 ` Jeffrey Carter
2012-12-27 19:51 ` Niklas Holsti
2012-12-27 20:25 ` Shark8
2012-12-27 23:53 ` Cedric
2012-12-28  8:00   ` Niklas Holsti
2012-12-28  8:30     ` Cedric
2012-12-28  9:29       ` Simon Wright
2012-12-30 17:29       ` Niklas Holsti
2012-12-28 11:52 ` Cedric
2012-12-28 15:36   ` Shark8
2012-12-30 16:03   ` Niklas Holsti [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox