Re: ++ of C in ada
- From: Jeffrey Carter <spam@xxxxxxxx>
- Date: Mon, 25 Jul 2005 05:55:23 GMT
nicolas.b wrote:
How can i implement the operator ++ in ada :
type T_Ptr is access all T_Item;
How can i implement : procedure Increment (Ptr : in out T_Ptr);
The fact that you're asking this indicates that you're at a stage in
your exposure to Ada when you will probably have no need whatsoever for
access types. Access types are rarely needed in Ada unless you're
creating a dynamic data structure, and even then you don't need pointer
arithmetic.
If you have some problem for which you think access types and pointer
arithmetic are required, let us know what the problem is and I suspect
we can show you why you're wrong, and what the Ada way is. In the
extremely rare case that you're not wrong, we can show you what to do.
--
Jeff Carter
"C++: The power, elegance and simplicity of a hand grenade."
Ole-Hjalmar Kristensen
90
.
Relevant Pages
- Re: pointer questions
... > True, but then you're not using Ada, you're using Ada and X, which I ... > so the code I write doesn't contain those access types. ... >> If I designed a language, I would go even further in that direction. ... >> I would allow mutually recursive types without intervening pointers. ... (comp.lang.ada) - Re: Heap Memory Management Question(s)
... I've been thumping through the LRMs for both Ada ... Ada 2005 allows anonymous access types ... T_ptr, so, at first sight, a clever compiler could deallocate these ... pointer to a local collection, return from the procedure, then reenter ... (comp.lang.ada) - Re: pointer questions
... you never need the kind of pointers the OP was asking about. ... Instead, I reuse existing generic data structures, so the code I write doesn't contain those access types. ... For learning Ada, one should write some dynamic data structures, but to use Ada, you should reuse existing dynamic data structures. ... (comp.lang.ada) - Re: pointer questions
... I use pointers all the time. ... anonymous access types -- there are probably hundreds of those ... You need pointers in Ada whenever you have complex data ... If I designed a language, I would go even further in that direction. ... (comp.lang.ada) - Re: Ada Popularity: Comparison of Ada/Charles with C++ STL (and Perl)
... > instantiations are inherently unsafe. ... It isn't different than Ada access types, ... That's an important design issue when designing reusable libraries. ... (comp.lang.ada) |
|