Prev: 100% without investment online part time jobs..(adsense,datawork,neobux..more jobs)
Next: installing SPARK GPL on Windows
From: Yannick Duchêne (Hibou57) on 10 Aug 2010 19:28 Le Wed, 11 Aug 2010 00:50:40 +0200, <anon(a)att.net> a écrit: > While the main expression are equal. The code generation by Ada compilers > versus C or C++ is less efficient do to a number of factors. > > 1. Elaboration: Ada compilers can generate run-time elaboration > routines that must be executed before starting > the main users program. C/C++ compilers do not > perform any run-time elaboration, which cause > the execution and code generation to be more > efficient but cause the less program to be less > reliable. > > 2. Run-Time Checks: The Ada compiler generates inline run-time checks > which the C/C++ compiler do not. Using the pragma > "suppress" statement can eliminate most checks. The > absent of these checks makes C/C++ less reliable.. Yes. You have the choice (with the former) > pragma Suppress ( All_Checks, ON => <name 1>, > ... > ON => <name n> ) ; > -- removes all checks on that set of names only. > -- Names may be an object such as an array or routine > -- Also, the "ON =>" symbols are optional Interesting point. Is that GNAT or other compiler specific ? I do not this variant in the reference. In â11.5 Suppressing Checksâ: > 3/2 The forms of checking pragmas are of a pragma Suppress is as > follows:4/2 pragma Suppress(identifier [, [On =>] name]); > 4.1/2 pragma Unsuppress(identifier); Standard or not, this seems nice. This may be better for centralized management of runtime-checks. -- There is even better than a pragma Assert: a SPARK --# check. --# check C and WhoKnowWhat and YouKnowWho; --# assert Ada; -- i.e. forget about previous premises which leads to conclusion -- and start with new conclusion as premise.
From: Yannick Duchêne (Hibou57) on 10 Aug 2010 19:38 Le Wed, 11 Aug 2010 01:28:25 +0200, Yannick Duchêne (Hibou57) <yannick_duchene(a)yahoo.fr> a écrit: > In â11.5 Suppressing Checksâ: > 4/2 pragma Suppress(identifier [, [On =>] name]); Strange. I've noticed it with the reply to you : the â[, [On =>] name]â appeared in the message while it is not visible in my reference. May be some trouble with the HTML version I use. So this is part of the RM. Hey... I've just check the online version at AdaIC, it says http://www.adaic.org/standards/05rm/html/RM-11-5.html 3/2 The forms of checking pragmas are as follows: 4/2 pragma Suppress(identifier); 4.1/2 pragma Unsuppress(identifier); Let me guess: the reference I use is a reworked HTML version of the annotated reference, where text originally marked as deleted are hidden. So I suppose this â[, [On =>] name]â was part of an old standard and was dropped with Ada 2005. .... some time later ... Yes, got it. The ARM for Ada 95 says: http://www.adahome.com/rm95/rm9x-11-05.html pragma Suppress(identifier [, [On =>] name]); This is no more valid Ada (well.... this is still valid Ada 95, this is just not more valid Ada 2005/2012) -- There is even better than a pragma Assert: a SPARK --# check. --# check C and WhoKnowWhat and YouKnowWho; --# assert Ada; -- i.e. forget about previous premises which leads to conclusion -- and start with new conclusion as premise.
From: Charles H. Sampson on 11 Aug 2010 02:42 Robert A Duff <bobduff(a)shell01.TheWorld.com> wrote: > csampson(a)inetworld.net (Charles H. Sampson) writes: > > > Robert A Duff <bobduff(a)shell01.TheWorld.com> wrote: > > > > I'm surprised, Bob. Are you saying that you signed integers in > > preference to a modular type for a variable that cycles? > > Yes. Unless I'm forced to use modular for some other reason > (e.g. I need one extra bit). > > >...I use > > modular-typed variables and, if I've got my engineer's hat on, write > > > > I := I + 1; -- Modular variable. Wraps. > > You're not alone. Even Tucker has advocated using modular > types for this sort of thing. > > But I think an explicit "mod N" is clearer than a comment. > > Variables that cycle are rare, so should be noted explicitly > in the code. And, as Dmitry noted, modular types only work > when the lower bound is 0. It's not unreasonable to have > a circular buffer indexed by a range 1..N. > > See my point? Still "surprised"? > I hope you didn't read my profession of surprise as being the same as "Wow! Bob did something really stupid." I just thought you would be one of the people (like me) who uses every feature of Ada whenever there's an opportunity. For the record, my uses of modular types have been as indexes into circular buffers. I think these buffers have always been my own invention, in support of a requirement but not a requirement in themselves. I'm not sure what I might do if it were natural, or required, to have a circular structure whose lower index is not 0. I learned to program on very slow machines and I've never been able to shake efficiency concerns. I've already thought of a couple of pretty unnatural things to do in order to achieve decent efficiency, efficiency that, as usual, is totally unnecessary in the problem domain. > > ... Can anybody recall the definition of "not" on modular > types, when the modulus is not a power of 2, without > looking it up? Hint: It makes no sense. The only feature > that's worse than "modular types" is "modular types with a > non-power-of-2 modulus". ;-) Actually, those circular buffers of mine have often had sizes that are not powers of two. The compiler I was using generated pretty decent code for them. Regarding what I read as your main complaint, very late in the Ada 95 effort I submitted a comment that the proposed modular types were an uncomfortable merger of two ideas: modular types and bit twiddling. Since there was no obvious relation between those two ideas (weak cohesion, as it were), I requested that two distinct types be used instead. I have no idea what the ARG thought of the merits of my comment, but even if they thought is was the most brilliant comment they had received, I submitted it much to late to have any hope of its being acted on. Charlie -- All the world's a stage, and most of us are desperately unrehearsed. Sean O'Casey
From: Niklas Holsti on 11 Aug 2010 03:06 Yannick Duchêne (Hibou57) wrote: > Le Wed, 11 Aug 2010 01:28:25 +0200, Yannick Duchêne (Hibou57) > <yannick_duchene(a)yahoo.fr> a écrit: >> In “11.5 Suppressing Checks”: >> 4/2 pragma Suppress(identifier [, [On =>] name]); > Strange. I've noticed it with the reply to you : the “[, [On =>] name]” > appeared in the message while it is not visible in my reference. May be > some trouble with the HTML version I use. [ snip ] > This is no more valid Ada (well.... this is still valid Ada 95, this is > just not more valid Ada 2005/2012) In the Ada 2005 RM, see section J.10 (Obsolescent Features: Specific Suppression of Checks). -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .
From: Charles H. Sampson on 11 Aug 2010 03:14
Elias Salom�o Helou Neto <eshneto(a)gmail.com> wrote: > It is a pity that this post became a technical discussion on array > indexing. A simple question that could be asked in a single line is: > can Ada access arrays without range checking? My algorithm needs not > wrapping, neither it needs range checking! In this newsgroup, as in most others, threads tend to take on lives of their own and can drift very far from the original post if they live long enough. The nice thing about this newsgroup is that threads almost never drift into noise. According to my newsreader, you had not yet asked your above question at the time you submitted this post. I have no idea when USENET posts are timestamped, but even if they appear to be in the wrong order, these two were submitted very close together. Your implied complaint that nobody's answering your simple question is somewhat out of line. Finally, in response to that question, the answer is yes, as others have pointed out. Use pragma Suppress (Range_Check, ...) (LRM 11.5). Charlie -- All the world's a stage, and most of us are desperately unrehearsed. Sean O'Casey |